Strawberry Alert: Day 4
Today I finally added aliens to the game! There is no level design or hit point system whatsoever. There are four aliens walking to the left. If the player attacks them, they die, otherwise they keep moving until they are out of sight. It is some progress, at least. I couldn't do much more because I spent most of the time chasing a silly bug. I created a template for the aliens with, among other properties, the speed. And since all aliens were created from that template, when I modified the speed in one alien, it changed of course the speed for all aliens, because it was a shared reference.
The cause wasn't obvious to me at the beginning because what the bug caused was that the second alien, fell through the ground. The issue was that after the collision check for the first alien, I correct the position and then I set the vertical speed to 0. To correct the position I simply subtract the current vertical speed from the vertical position. So the second alien had the speed already set to 0 when correcting the position, therefore the position didn't get corrected. It's been a while since I felt this stupid.
My plans for the future are:
- Create a bit of a map, with platforms and aliens coming from different places.
- Add a hit-points system. The hero would have 4 hit points and lose one each time she collides with an alien. If she reaches 0 hit points, the game is over.
- The player will only be able to move forward. Once he gets to the end of the level, the game is over and the final score depends on how many aliens were slain.
Discussion