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

Username:   Password: 
 RegisterRegister   
 How can I move a polygon?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
skyler




PostPosted: Tue May 16, 2006 9:20 pm   Post subject: How can I move a polygon?

Hi i'm a new member, and i'm using turing these days for school , and i'm having trouble moving the following polygon:

var x : array 1 .. 3 of int := init (110, 140, 170)
var y : array 1 .. 3 of int := init (410, 425, 410)
drawfillpolygon (x, y, 3, red)

If anyone can help me i'd be grateful, Thank you.
Sponsor
Sponsor
Sponsor
sponsor
TheOneTrueGod




PostPosted: Tue May 16, 2006 9:50 pm   Post subject: (No subject)

Hi, welcome to compsci.
First of all, thank you for using a descriptive title in your post.
Second of all, please use code tags. Highlite the section of your code that is from turing, and press the "Code" button directly above the post box.

Allright, now to help you.

You need a loop around the drawfillpolygon command.
Once you have that, the only way to move it is to change its co-ordinates

code:
var x : array 1 .. 3 of int := init (110, 140, 170)
var y : array 1 .. 3 of int := init (410, 425, 410)
loop
   for i : 1..3
      x(i) := x(i) + 1
   end for
   drawfillpolygon (x, y, 3, red)
   Time.DelaySinceLast(30)
   cls
end loop


Also, consider using View.Update, but that is just something that everyone prefers, and not something directly related to your problem.
skyler




PostPosted: Tue May 16, 2006 10:03 pm   Post subject: (No subject)

Thank you very much THEONETRUEGOD for your fast reply, and it really helped me alot , and for the "CODE" i'll try to use it next time even though i've never used it before but i'll try .
Clayton




PostPosted: Tue May 16, 2006 11:06 pm   Post subject: (No subject)

if you have any questions pertaining to anything Turing, look through the Turing Walkthrough, in which a HUGE collection of tutorials for just about anything Turing related are located Very Happy good luck
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  [ 4 Posts ]
Jump to:   


Style:  
Search: