Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Polygon and circle moving
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
chant_seg




PostPosted: Thu Apr 05, 2007 6:43 pm   Post subject: 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 . Confused

code
Mod by Clayton: Added code tags.

Turing:

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
Sponsor
Sponsor
Sponsor
sponsor
richcash




PostPosted: Thu Apr 05, 2007 8:06 pm   Post subject: 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.

Turing:
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




PostPosted: Fri Apr 06, 2007 11:26 am   Post subject: Re: Polygon and circle moving

Hey!
Awsome! thanxs a bunch! Laughing It really helped, i'm still new at Turing so i'll have much more questions later! Thanxs again Wink
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: