
-----------------------------------
chant_seg
Thu Apr 05, 2007 6:43 pm

Polygon and circle moving
-----------------------------------
Hello, I am new this is my first post. 
I have to make a Polygon move as the circles does in my code 
I have been reading and researching but all I try fails
I was wondering if anyone could give me a hand or point me in the right direction it would be appreciated at this point 
Thank you .  :? 

code
Mod by Clayton: Added code tags.


var c : int
var x : int
var y : int
x := maxx div 2
y := maxy div 2
c := 12
loop
    c := c + 1
    x := x + 8
    y := y - 5
    delay (200)
    drawfilloval (x, y, 30, 30, c)
    var r : array 1 .. 8 of int := init (100, 100, 135, 185, 220, 220, 185, 135)
    var s : array 1 .. 8 of int := init (100, 150, 185, 185, 150, 100, 65, 65)
    Draw.Polygon (r, s, 8, c)

    exit when hasch
end loop


-----------------------------------
richcash
Thu Apr 05, 2007 8:06 pm

Re: Polygon and circle moving
-----------------------------------
If you want to move a polygon, you have to change each element of the x-coordinates and y-coordinates arrays.

for i : 1 .. upper (r)
   r (i) += 2     %coordinates can change at any rate desired
   s (i) += 1
end for

And you have to declare your r and s arrays outside of the loop so they are not reset back to default values each time.

-----------------------------------
chant_seg
Fri Apr 06, 2007 11:26 am

Re: Polygon and circle moving
-----------------------------------
Hey!
Awsome! thanxs a bunch!  :lol:  It really helped, i'm still new at Turing so i'll have much more questions later! Thanxs again  :wink:
