Day 9: Adding Enemies
Development time: 2 hours
I created two new control icons and then changed the menu controls for "play" and "high scores" from text to graphics.
By adding the background animations the overall game animation was getting choppy. The existing animation loop was a stand-alone timer. I set the project frames per second (fps) setting to 60 in config.lua and then changed the main loop into an "enterframe" event listener. This ended up smoothing out the overall animation just fine.
I thought the game needed more than just asteroids to shoot, so I found Kenney's original space shooter graphics and created a sprite sheet with 4 enemy ships. I also added physics body filtering, so that the enemy ships wouldn't collide with the asteroids. Then I copied the code that lets the player shoot bullets and changed it to allow the enemy ships to shoot bullets at the player. Five more sounds were randomly created, one for each enemy ship entrance and one for enemy fire.
It took a lot of testing to get all of the collision filters correct, and have the collision detection routine handle all the new collision pairs.
Next: Day 10
Leave a comment
Log in with itch.io to leave a comment.