The fifth day of development.

First things first i correctly the oops that i forgot to do sooner, which was set the inital number of lives when you start a game.

Implemented a improved EnforceVaderBounds which is responsible for detecting when the Invaders have hit the edges of the screen, and change direction.
Firstly I fixed a slight problem in PlayerShootVaderDetection() which was not doing equality checks on the boundary just > and <. Secondly split up the index calcuation to provide the X index (so column), and added an array which for each column stores the number of invaders remaining alive, and so when one is hit it decrements using the X index from this array.

This allowed the implementation for EnforceVaderBounds(), which provides more accurate ability to bounce off of the sides, instead of just being the first and last column we consider first if the nearest column has invaders left if not we go by the start of the next column.

Using the lovely piece of code below, the right way is the same but goes from 10 to 0.

// Calculates the left most column with any invaders still living.
for (i = 0; i < 11 && invadersAlive == 0; i++);

Next on the todo list was the Pause screen this included creating a new state, and then overcoming a problem. At the time when the state changed we call the deinit method for that state then when we return we call the init. So when going from Game -> Pause we would loose all the information then Pause -> Game would start a new game. The solution was add a boolean to the ChangeState that defines weather this state change is to a cleanState (eg will deinit and init be called), so a un-cleanState would be the pause which leaves the Game State still set. finally added how to draw the pause screen.

Accidentally forgot to commit the 🙂 new files as per usual with new states (like i did with the game state for quite some time)

I had considered a “Demo” as a Windows release but I think i will hold out until final.

Next time: Game Over State, Invader vertical movement so they move down, and went touch the just above you, you loose a live and it restarts the level. Hopefully I will get enough time tomorrow to handle all of that.

Donno Signing Off.

Advertisements