Saturday, March 9, 2013

Multiple Levels

My recent work on my scrolling shooter game has resulted in both levels being playable, without having to change any code and reinstall the game. As I've been wanting to do, I have added the code needed to switch levels once a boss has been defeated. Since there are only 2 levels in my game right now, it isn't particularly hard to beat the game, but I can easily see this amount available in the Lite version of the game (with some better graphics and a few additions of course).

I also added some pathing for the player sprite when a level begins and ends. When the level starts the player's sprite rises on to the screen from the bottom. There is an image on the HUD displaying what the current level is. After a couple seconds, this display disappears and the player assumes control of their sprite. Similarly, when the boss of the level is defeated, the words "Level Cleared!" are displayed, and the player sprite follows a path off the screen at the top. The level of the game then increments and the next level is handled in a similar fashion.

Everything seems to be going pretty well and the game is nice an playable at present. I might need to look into my level progress bar again as it seems to be a little off at the end of the game. It might be a threading issue, but it isn't currently on the top of my priority list, so I'm not too concerned. What I am more concerned with is how to handle a collision between the player and a boss sprite. It was a non-issue with player/minion sprite collisions as I simply damage the player, kill the minion, and the game continues. However, since I can't just kill off the boss during a collision, it becomes more of an issue. I currently have the player being "teleported" back down to the very bottom of the screen if they collide with the boss, hoping to move them out of the way. If they were simply left there, another collision between the boss and the player would be detected and the player would be dead before they understood what was happening. This method worked pretty well, until I made the second boss dive low on the screen. When the player is teleported, they are still (at times) within the collision distance to the boss, so they still get hit multiple times. Obviously this isn't good for the player because they should always be able to tell when they are being hit. As a result, I've decided to trigger 2-3 seconds of invulnerability when the player hits the boss. They will still take a single hit of damage, but assuming they survive that hit, they will not take damage for another 2-3 seconds. When I have this functionality added, I will also be able to make a 3rd powerup that allows the player several seconds of invulnerability, similar perhaps to a star in any of the Mario Bros. games, but I likely wont give the player the ability to destroy minions via collision while in the invulnerable state.

Keeping in line with my thoughts on making sure the player realizes when they take damage, I'm also going to cause the player's device to vibrate whenever they take a hit. There will be a button to toggle this feature off in the eventual settings page, of course, but I think it is something most players will benefit from leaving on.

No comments:

Post a Comment