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. |
Comments
Post a Comment