Jump to content
  • Advertisement
Sign in to follow this  
Stutesman

trouble alignment

This topic is 4904 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

im making a 2d scrolling shooter and im having trouble lineing up the sprites. when your in the center of the screen the bullets line up perfect but at when you fly to the bottom of the screen the bullets fire out to low, and at the top to high. i am using OpenGL and the location that the bullet is fired from is dependent on the location of your ship bullety[numb]=ypos-0.1f; bulletx[numb]=xpos+1.85f; these are the lines that start the bullet where xpos,ypos are the varibles for the location of the sprite for your ship using glTranslatef(xpos,ypos,z); to positiong the ship does the drawing of the sprite move in comparision to the xpos,ypos depending on its location on the screen?

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure how you've got things set up, but my first thought is to check and make sure that the z values for your bullets are the same as the z value for the ship that fires them. What you describe sounds like you have perspective projection on, and your bullets are 'closer' to the viewer than your other sprites. Just a guess, though.

Share this post


Link to post
Share on other sites
man cant believe i didnt think of that
havnt actually checked it out yet but i think your right on the money

thanks for the help

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!