If at first your code doesn’t succeed- write that code again. Today I realized that some of my code wasn’t practical. I originally thought to attach the shield strength to lives, but for some unknown reason, I was only thinking under the parameter of the player having three lives upon powerup….yeah…not realistic. The player can have any amount of lives ranging from 3 to 1 and still be eligible for a lives powerup…so that’s not going to work. That would definitely throw the sprite artwork off and I would have to make several sets of shield sprites…not to mention, that the switch statement uses cases that would have to be reprogrammed- too much work for so little reward. Thus, the shield code for now is scratched.
Today I had the greatest progress in these areas:
- Health Collectable- the sprite and code are complete. This was tricky. I tried different types of code to make sure that the number of lives didn’t exceed 3. At first, I Googled how to limit player lives and it came up that using an if statement where if lives > 3, then lives = 3, but that didn’t work… It wasn’t compatible with my health powerup. The health powerup was being recognized, but the game wasn’t recognizing that powerup was healing the player lives. After getting help from Clyde, I was able to understand that my issue wasn’t that my collectible wasn’t being read, but A) it just wasn’t disappearing and also, that B) player damage was being activated for lives being 1 or 2, but I had to program them being turned off when lives increased past 1 or 2…will work on that.
- Thrusters- left shift being pressed increases player speed and normal speed returns when it’s released. For this, I originally thought a singular KeyDown would work, but that alone wasn’t returning the speed to normal. I had to pair that with a KeyUp function to do so.
Stay well friends,
Kristin