Jump to content
  • Advertisement
Sign in to follow this  
Doomhauer

Making Asteroids in Java

This topic is 3079 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 folks, My end of year unit for college includes making an Asteroids clone in Java. I think I know how all my classes are going to work out but am having a few problems with the basics. Mainly I cant seem to get any sort of fluid movement to my key events, the ship object will move in response but very awkwardly. Any tips regarding the building of asteroids would be greatly appreciated! Thanks -D

Share this post


Link to post
Share on other sites
Advertisement
Instead of using your keys to add movement to your ship, try to use a system closer to how real life works. Instead of incrementing your position by x at each keystroke, use a system based on Velocity and Acceleration.

This should give you all the information you need on connecting those elements and making a fluid movement.

Share this post


Link to post
Share on other sites
I don't know how you build the main-loop of your game. But Kev over at cokeandcode.com has a nice tutorial for Java2D games: http://www.cokeandcode.com/info/tut2d.html

Hope it helps

Share this post


Link to post
Share on other sites
Instead of tying the movement directly to the inputs (I'm assuming your keyboard), you may want to use the keys to instead enable/disable some sort of "moving" boolean, then have your game loop move the player depending on the state of that boolean. This helped get rid of key-press lag in some java games I worked on recently, where the OS will confirm the first keypress but won't confirm a constant press right away, resulting in a stutter every time you hold down a new direction.

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!