This update is very long overdue, the text actually has been sitting in a text file on my computer for quite some time.

It has been a while, currently waiting for a bed to arrive so decided as good as time as anyway to work on my Space Invaders game. A couple of nights ago I did do some work on it, I replaced all the menu graphics with ones Izzy and myself made. I also replaced the bullet and your turrent with ones I made.

My goal for this session is have the bonus ship that flies across the top from time to time, implemented both
in the movement code to allow it to fly as well as the
being able to shoot it. I spent a few moments making a sprite for it using the same style of the turrent

I don’t currently have internet at home/ on my computer so my ability to code is some what reduced.

The idea for handling the when the bonus mothership appears is on start randomly generate a number and store it, and find the perfect spot to decrement this number in, so when it hits 0 then the ship will appear on the screen and travel across it. Considered doing the seed based on time but really not that fussed. The formual I went for in the end was invaderBonusSpawn = ((RAND_MAX – rand()) >> 4) + 400; and then settled on invaderBonus.spawnCount = ((RAND_MAX – rand()) >> 4) + (1000 % rand() );.

Some slightly intresting trick I did is the movement of the bonus ship moves by generating a random number if it is even it will increment the ship by 1.
Comitted my work, at this stage i have spawning, rendering, translating of the bonus invader implemented. The next part is collision detection with the player’s bullet and if detected then increment score and set invader to dead. All up took me about 35 minutes. Most of which was spent playing with the velocity of the bonus invader and the spawning.

The collision detection part was a whole lot easier only took about 15 minutes all up, just required me to track where the collision detection code for the bullet occurs, add the apporiate if statements, and then if it is the bonus ship set the bullet/ship to dead, and increment the score and reset the spawn counter for the bonus ship.

Now for a quick summary of things to do to truely make this project complete is allow the invaders to shoot down at the player, and also implement the shield blocks so you can hide under, and shoot through, and also have them discitergrate when the invaders move through it.

As it stands the current media assets are 1.4MiB, the executable is 16.5KiB, and third party libraries (SDL) are 994KiB.

Okay Nexus will take a look, mainly just used it as a project to figure out ways to setup and use SDL, and how to structure some things, and was just aiming to replicate the basic game play.

Advertisements