Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Object motion help

This topic is 6305 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I'm trying to make a triangle move around the screen using the keyboard. When drawing the vertices for the triangle, I add a value to each parameter, like glVertex3f((1.0f + xmove),...) Then, in KEYDOWN of the message handler, I have 4 if statements to see if the key pressed was an arrow key, and if so, I increase/decrease xmove & ymove. I'm having a problem: I get a double image of the triangle if the xmove/ymove is small (to simulate less jumpy motion) Whats the difference between moving the coordinate system to the triangle then translating it, and the way im doing it? I'm trying to make a simple scrolling space fighter game, so I thought I should start by making sure I can move an object around the screen. --SK Edited by - Sketchy on June 22, 2001 1:35:12 AM

Share this post

Link to post
Share on other sites
ok, dont change the vertices on the triangle, just create a set of global variables

float x,y,z;

and do this just before you draw your triangle


then set your keyboard commands to modify the x,y,z variables

i would reccomend a switch statement in the keyboard function.


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!