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

Username:   Password: 
 RegisterRegister   
 How do you move Polygons?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nyrd




PostPosted: Sat Nov 20, 2004 4:22 pm   Post subject: How do you move Polygons?

I'm making a 3-d type game using polygons. I came to a problem. I CAN'T MOVE ANY POLYGON !!!

It's not that i don't know how, we learned that in class, but i always get an error message such as "Compilation Time expected" (What does it mean anyway?) If you could help it would be much appreciated.
Sponsor
Sponsor
Sponsor
sponsor
Mr. Glib




PostPosted: Sat Nov 20, 2004 4:39 pm   Post subject: (No subject)

Nyrd,

when you mean 'move' do you mean erasing the polgyon image that you've drawn and then redrawing it somewhere else on the screen or are you refering to animation?
Cervantes




PostPosted: Sat Nov 20, 2004 5:15 pm   Post subject: (No subject)

Posting the code that is giving you trouble (and any code related to it that you deem necessary [such as variable initialization]) will help us to help you.
Tony




PostPosted: Sat Nov 20, 2004 5:20 pm   Post subject: (No subject)

your polygon should be in the form of

(p1x + x, p1y + y, p2x + x, p2y + y, ... pNx + x, pNy + y)

where p#x/p#y decribe verticies in relation to each other (as if the shape was centered at (0,0) and +x +y are offsets that actually move the shape around.

It's the same for 3D, you just also have the +z.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Nyrd




PostPosted: Sat Nov 20, 2004 6:12 pm   Post subject: (No subject)

code:

It's the same for 3D, you just also have the +z.


Does this mean that turing has an inbuilt 3-D drawing function?
Cause the way I'm making it 3-D is by drawing one polygon, morphing it to the shape i want, then drawing another in a lighter/darker colour the fits with this one to make a 3-D illusion.

code:

var x : array 1 .. 9 of int := init (100, 100 , 135 ,
            185 ,
            220 , 200 , 137 , 55 , 5 )
        var y : array 1 .. 9 of int := init (150 , 150 , 145 ,
            185 ,
            150 , 135 , 102 , 50 , 50 )
          Draw.FillPolygon (x , y, 9 , grey)
    var x1 : array 1 .. 5 of int := init (220, 200, 135, 135, 50)
    var y1 : array 1 .. 5 of int := init (150, 120, 85, 65, 50)
    Draw.FillPolygon (x1, y1, 5, darkgrey)


If there is another way please tell, cause this one takes a while to get to look right
Tony




PostPosted: Sat Nov 20, 2004 6:16 pm   Post subject: (No subject)

are you trying to draw a single image that looks like 3D, or an actual 3D shape that you can rotate?
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Nyrd




PostPosted: Sat Nov 20, 2004 6:17 pm   Post subject: (No subject)

oh yeah, what i mean by move is that i make the polygon, erase it then draw it in another place. I use this cause it's the only way i know, how does the other work?
Tony




PostPosted: Sat Nov 20, 2004 6:21 pm   Post subject: (No subject)

yeah, that's how you do that. I'm just wondering how you determine where to draw it in the next frame.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: