I’ve actually gone off on a tangent now and done so much work around Rotate Space instead of keeping the blog up to date. Since the last entry I’ve done the following…
- Added a basic title page and start process
- Taken the star handling process into a new class.
- Level completion and leveling up
- Added new ability to move forward slightly to avoid a collision
This is a basic as need to get up and running. Simple title, press fire, reset in game info (scores, etc) and away we go. Thinking this was a little on the bland side, I’ll need to make it more inviting. The first thing was to add the star effect on the title page. It works really well, and is a visual hook in, especially for a HTML game.
As I’m reusing the star field on another stage, I needed to eliminate the duplicate code, so extrapolating the star code out into a new class which is invoked on each stage creation means I only have one code stream.
Each time ‘createStars’ is called, it creates 600 small sprites, which are used for the star field. You can read about this here.
Each level/wave on the game is very much the same. I am going to introduce a bonus level in between which involves avoiding asteroids, but otherwise, the enemies come from the centre, you spiral round and shoot them.
Each level will increase the numbers of waves of enemies, and the speed at which they come at you.
To do this, it’s a simple repeat timer for x number of times, with an extended one for the leveling end. There are slicker ways of doing this, but for a quick shoot-em-up, it’s suffice.
You gain bonus points for the hit ratio (number of shots fired against the number destroyed) and this is displayed on the level up state. Once this is added to your score, the ship zooms off in to the distance, the screen fades and we go round again.
Eventually, there will be too many enemy ships on screen to cope with.
As you could only spin around the outside, it didn’t leave much room for manouevre, so I’ve added a little extra movement, which (using the up and down cursor keys), moves the ship forward and backward slightly to avoid a collision with the enemy.
As I mentioned, I’m going to add an intermission level in between each level where you have to avoid the asteroids. The longer you survive, the more bonus points, but when you die, it won’t decrease the life counter.
Click here to see the latest progress to my #30daydev