Space Invader game assignment

Space Invader style shooter game
In this post I will show you how I created my space invader game. The game is designed around the original space invaders game, so a lot of sprites will seem similar- and maybe identical. I made some changes to make sure it's not completely identical. I will show the  game's sprites below.
Here are the sprites of the aliens the player has to destroy in the game. The sprite above is the parent object of the sprites below, this means that what ever code and commands are made for the parent, the other objects(aka the children) will have exactly the same commands; the only difference is the sprite. I sprites I used in this game are inspired by the original sprites in Space Invaders, the parent object sprites are almost identical to one of the aliens in the original game; I did not want to make all sprites identical as it would not be very original.

I have made a couple changes to the sprites since I have been adding them to my blog. The sprites below didn't have their black eyes until I edited them; only one of them will actually have black eyes instead of just holes, however whoever's reading this won't know the difference because my blog has a black background.


This is the sprite of the games protagonist, known simply as the "player". It's the same as the original except it's blue, the reason I didn't make any changes is because the original was so simple, but it does it's job so well. The sprite feels very good to move around the screen when playing, and the design resembles some sort of turret, or a tank; it's really up to your imagination.
Here is the sprite of a flying saucer shaped object, it will randomly fly across the top of the screen, if the players hits it they will get 100 points, this is similar to the original space invaders.
This sprite strip shows the animation of the player's shield's as they are damaged by the enemy lasers. I did have some issues with this, as the strip would constantly animate when I tested my game, I solved this by only allowing the next image to show when it had been hit by an enemy laser. This animation is not like the original space- it's not as advanced. The original shields would be "molded" by the enemy lasers, I couldn't do this because I am not an advanced programmer like the creator of the original game; I thought about giving it a try, but it will just take too long to successfully pull off. There are 7 animations in the strip, the last one shows the shield has been destroyed.
This is the Logo I used on the Start menu.



talk about the bugs and how you solved them


This image shows the functions of the object the player controls. I created it using a mixture of drag and drop commands, and some code. You will see in the image the code for the players movement. You might see two keyboard events- left and right- these are not used, I deleted them after the screenshot was taken, the reason for this is that drag and drop events are not as specific as coded instances, so I had many movement issues when using them.

This screenshot shows two objects, the ship which fly's across the screen- known as the mothersip- and a boss which I created for a later level in the game. The ship which fly's across the screen is a very simple object, it is set to a path, and it uses an alarm event to randomly carry out it's actions. I did have some problems with this though, the ship would randomly stop in the middle of it's path, but then it would just carry on after a couple seconds- I didn't really do anything to solve this because it didn't really do any damage to the gameplay, I should have taken advantage of this bug, and made the drop a bomb on the player; this would have made the game more challenging.
The boss was a lot more complex than the other object in the screenshot, it basically needed to be a stronger, faster, and bigger enemy than the others in the game. I wanted to give it a health bar, but I have not had much practice with health bars so the I encountered some problems. 
Here is a more detailed screenshot of the boss's object


This screen shot shows the events and code of the aliens in the game. There are three aliens in my game, but one of them is a parent object to the other two. This means that all the events and code that are found within the parent object, will also be in the other two objects- what are known as the "children". The screenshot shows the code of  the aliens movement, the aliens move down the screen in the game and get faster- getting closer to the player. if the aliens reach the collide with the shields- the player fails and loses a life, or gets a game over. I had problems with this code though, the original code I learnt with the aide of the YoYo games forums and a YouTube tutorial, but this didn't work with my game, the problem I faced was that the alien would move too quickly down the screen; to a point where it was impossible to beat the first level of the game. The way I solved this was to create multiple alarm events, so that they move down, take a break, move down again, take a final break before reaching the shields.

 If I were to add anything to this, I would increase the difficulty as the game progressed- so I would increase the timing of the alarms. Another piece of code you will see is the step event in the lower right hand side of the screenshot, this code determines the horizontal movement along the x axis for the aliens. The problem I faced with this was that the aliens would move too far on the x axis, to solve this I put some wall objects outside of the room, and programmed the aliens to change horizontal speed when they collided with them- depending on what side of the room they are on.
The screenshot above shows the events within the player's laser object. The object seems like it should have a lot less events inside it, but when making a game with multiple enemies inside a room, you have to make sure that each laser or bullet destroys the enemy it hits; I had trouble with this because when I hit one alien, all the aliens in the room would be destroyed along side it. I solved this with the code you can see above and also a destroy instance command within the aliens code- which is set to "other". You might also see some code referring to "hp", this means health points or hit points, and I was trying to create a hit point system for the boss battle, but the boss doesn't seem to take any damage- even though I have set it to have it's on health points; I think I will figure out this issue in my own time- just to help myself understand how to make a good boss battle, because they are an essential aspect of game design. 




The screenshot above shows the code which went into the start screen. This code makes a basic menu appear when you start the game. The menu consists of to options- Start Game, and Quit Game. If this were a professional release I would need to add a lot more to the start menu, for example an options menu should be available for every game- but it can help the player setup the game to how they want to play it- for example a "display settings" option should be available, so the player can adjust the resolution of the game to the specifications of the device they're playing on; however this is not always available on console games. The menu uses several events to function, the first is a create event, this uses some string code to show what text will be placed here, but it is the link with the script which makes it functional. The next event is the step event(bottom right box) this determines the movement of the menu- it shows all the possible which can be pressed to make the menu function- the up and down arrows on the keyboard are used to navigate the menu, but the keys W and S are also accepted- the buttons which are used to select an option are also shows; it's always good to have multiple controls on a menu and in game, because everybody has their own preferences for controls. The final event is a Draw event, so as you can probably tell from the name, the code is this event will draw the text which will be displayed in the menu, this code will determine what font is being used, and the colour of the font.
Here is the script used for the start menu


I had a lot of trouble with lives, first they were not even showing up on the screen, even I had made an event which told them to draw lives as an image. I will talk about them later on in this blog.

Here are the two other aliens, as you can see in the parent section of each box, the parent is set to the alien with all the events and code.


Here is the object for the players shields, as you can see in the code, the sprite of the shield changes every time it is hit by an aliens laser. I mention earlier about the trouble I had with the sprites animation.


This line of code can be found in the controller object. What the code does is change the room when all the aliens in the room have been defeated.


Here is the background I used for the first level of my game. I made this to make it feel like the player was defending more than a dark space; If I had more time I would of made the backgrounds be similar to famous cities like New York, London, and Tokyo. I had trouble at first because the image was too sharp, that I would be in the way of the player, I solved this by lowering the opacity on the colours I used.



I made some changes to the to the events relate to the players lives. All the problems were to do with the collision with the aliens laser. Basically I forgot to really set up an event which placed the player back where they started after they had been killed. But I still face some problems, for some reason the players lives will not decrease after being killed. I imagine its something to do with me making a small mistake somewhere else in the game, which has consequences to this section.























Comments