So, having created the shapes for the asteroids, ufo and player ship. It's time to move them about. The number of asteroids will be governed by the level - I've set to 5 at the moment. The starting position (x,y), heading in furmans and speed for the asteroids are set randomly.
At the moment the ship and ufo are moving perpendicular to each other. A polar conversion routine using sin/cos is used to translate the velocity and heading into cartesian coordinates. The GD library provides lookup functions for this purpose.
Code will be available here:
https://github.com/mattuna15/merlin-software/blob/master/asteroids/asteroids.s
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.