Jump to content

90 Degree Turns at Max Velocity in Asteroids


Kreeba
 Share

Recommended Posts

Hi. I am working on a 2D asteroids game, and I have hit a snag with the 'standard' asteroids maths.

I have implemented https://codepen.io/SitePoint/pen/rLvZrG into my game (I am using BabylonJS to render, but this isn't a babylon issue).

That the problem is:

Problem:

  • Press W Key to accelerate 'up' and hold it there until you reach the maximum value.
  • Then release the W Key and the momentum will continue.
  • Rotate ship to 90 Degrees and hold W again.
  • Because the Max velocity values are already met, you can never end up going 'streight'. Rather you will then cap out at a sort of 45 degree,

How can I adapt the maths to be able to cancel out the y (or x) value if there is no direct thrust in that direction?

 

Thanks

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...