2D Game Dev Journey — Day 20: Giving Enemies Movement
Welcome to 2D Game Dev Journey — Day 20: Giving Enemies Movement. Today I go over how I added some movement to my enemies and add a bit more to our background as well.
Starting Point & Setup
Today we will be starting right where we left off in 2D Game Dev Journey — Day 19: New Background & Negative Power-ups.
To add a bit more life to our background, I went ahead and created some planet sprites
Improving our Background
With our planet sprites, I plan to have them move from the top to bottom of the screen, just to help with the feel of the game. To accomplish this, I spawn the planets at a random position, with different scales, and have them fall to the bottom of the screen at a pretty slow pace to give the feeling they are in the distance.
Still need to work on the aspect of depth with the planets, but we can tackle that at a later date. For now, this is fine.
Now moving forward, I will be adding in a variety of new enemies. For today, I will simply be adding in some side-to-side movement for the basic enemies we have had with us thus far (their design will change in the future). After some coding, this is the result I got:
Even with some basic side-to-side movement, the difficulty is increased, and beyond that, the game just feels much more alive.
Thanks for checking in and reading today’s article. In the next few updates, I will be making some new enemies. If I have made any mistakes, please let me know so I can correct them for future readers. If you would like a more in-depth tutorial about anything I went over today, let me know and I will take the time to write something up.