Scrolling Shooter

 

 

Description

In this game you control a plane flying over a sea. You encounter an increasing number of enemy planes that try to destroy you. You should avoid these or shoot them. The goal is to stay alive as long as you can and to destroy as many enemy planes as you can.

Game objects

The background is formed by a scrolling sea with some islands. The player’s plane flies over this sea. You can shoot bullets that destroy enemy planes. There are four types of enemy planes: a plane that you encounter and should be destroyed, a plane that fires bullets downwards, a plane that fires bullets towards the player’s plane, and a fast enemy plane that comes from behind rather than from the front.

Sounds

There are some explosion sounds and there is some background music.

Controls

The player controls the game with the arrow keys. With the space key you fire a bullet. Only one bullet can be fired every five steps.

Game flow

The player immediately jumps into the game. The player has three lives. When all lives are gone a high-score table is shown. Pressing the <F1> (help) key will give a brief explanation. Pressing the <Esc> key will end the game.

Levels

There is just one level, but more and more enemy planes will arrive: first only the easy type but later the more difficult types

 

Scrolling Background

 

As our game takes place over the see we need a background image that looks like a see viewed from above. Add the following small image as a background resource to the game and give it the name bkg_water:

To create a room with a moving background, add a room to the game. At the left click on the tab labeled backgrounds. We need to change three settings here.


1. Uncheck the box labeled Draw background color.
2. Click on the menu icon and select the bkg_water background image.
The default setting is to tile the whole room with it so this is what we want.
3. Finally, we need to make the background move. At the bottom, set the Vert. speed to 2.

The form should now look as follows:

 

Adding Islands

Create three sprites island images (with transparent background):

Uncheck the box Precise collision checking since we will not be checking for collisions.

For each of the islands we create an object.
Give the object a vertical speed that is the same as the scrolling speed of the background.

To make sure that all other objects will stay above the islands give the island objects a Depth of 1000.

 

When the island disappears below the bottom of the room we want to make it reappear at the top.We can use the built in feature of room_height a to do this.

To move to the top of the room we use the action to jump to a position. We want to jump to a random position above the room, not a particular one. In the jump action we use random(room_width) as the x-coordinate. This will create a random value between 0 and the width of the room. So the jump action will look as follows:


 
The Main Plane

First of all we need a sprite for the plane.

The plane can be found in the file myplane_strip3.png in the Resources folder, or find your own.

This time set the origin to the center of the plane

Add the object obj_myplane. Give it a depth of –1000 to make sure that it lies above bullets, etc. that we will create later.

 

Using left, right, up and down arrows move the plane in the appropriate direction. Since we don't want to move the plane of the screen we will lock it when the value is near the border. Below is the code for Left, figure out the rest on your own.

 

 

 

 

 

Enemy

Add the enemy planes. They simply fly down.(I know ..... boring, we will make it more complicated later)

Create - set the vertical speed

Outside Room - respawn random.

add collision events for the enemy plane:collision event with the main plane which should destroy the main plane and end the game.

 

 

Weapon

Let us start with the canon. We need a bullet sprite. To make it a bit spectacular we use a rather large bullet. Exaggerating things is often important in games. Make sure to set the origin to center.


Create an object with this sprite. Give it the default depth 0 so that it will appear below the plane but above the islands.

On the Plane add the Space key and create a bullet

On create of the bullet - set the verticle speed of the bullet

On Outside Room of the bullet - destroy the instance so the bullets do not continue to fly outside the room.

Wow ....... way to many bullets. We need to slow things down

We will only allow the player to fire two bullets every second, that is, one bullet every 15 steps. To achieve this we use a variable can_shoot.

In the create of the plane set can_shoot to 1, indicating that we can indeed shoot a bullet.

And add an Alarm to determine when we can shoot.

On the space key event we test whether the variable can_shoot is equal to 1.

If so:

-create a bullet just in front of the ship, relative at position (0,-16) or whatever yours is
- add a second bullet if you wish

- set the variable can_shoot to 0 indicating that we can no longer shoot
- set alarm0 to 15 (an alarm ticks down to 0 with one tick in each step. When the alarm reaches 0 the alarm event happens)

In this event we set the variable can_shoot back to 1, indicating that we can shoot again. So the event for the space key will look something like this:

 


 

Collision Event with the Bullet

Play a sound, play an explosion, respawn the enemy off the screen at a random location and set the score.


Collision with the Main Plane

Again we will need an explosion sprite (a bit bigger this time) and an exploding sound (a bit louder this time).

In the explosion Animation end event we do a few things. Destroy the instance. Sleep a while to make sure that the exploding sound is finished. Show the high-score list. Finally restart the game. So the event looks

Later we will give the main plane damage.


Spawning more planes as the game continues. Just like we did with the bombs.
Note: Remove the original planes that you added!!!

Create an controller_enemy object . In its creation event we create an enemy place at a random location just above the room. This will be the first enemy. We also set the alarm clock to 200. In the event for this alarm clock we create another enemy plane and set the alarm clock again, but this time to 500. That is all. The effect is that at the beginning of the game there is one enemy plane. After 200 steps, that is, about seven seconds, a second enemy plane appears. After about 15 seconds, a third plane appears, etc. (The reason that we let the second plane appears faster than the other ones is because the game with just one enemy plane is too boring.) Place one instance of the controller object in the room and we are done.

 

 

 


Scores, Lives, and Damage

Damage

To make the game a bit more interesting we will let enemies create damage. Only when the plane gets too much damage will it be destroyed. Also we will introduce multiple lives and create a nice information panel that shows this information, together with the score.

To create all this we make a new object called the controller_life. It does not need a sprite.

 

 


It will show the score, the damage (in the black area at the left), and the number of planes left, that is the number of lives. In the drawing event of the controller_life , draw this information panel sprite at the correct position using the action to draw a sprite.

I placed mine at the bottom of the screen

This will place the correct sprite at the bottom of the screen. To make sure that the bottom panel lies above everything else we give the controller_life object a depth of –10000.

In its creation event, the controller_life object sets the score to 0, the number of lives to 3, and the health to 100.

Draw the score, healthbar and lives

 

Drawing a Health Bar that is 100 wide and 10 high


So on collision decrease the health, you can do the same thing when the main plane hits the bullet. If we -30 then the plane will take 3 hits. (20 - 4 hits, 10 - 10 hits etc.)

Reset the health, explode the main plane

After the Plane explodes, (Animation End of the Explosion) destroy the explosion, create a new plane and subtract a life

On No More Lives show the high-score list and restart the game.

 

Modifying your Enemies

Enemy 1 and 2 will fire bullets straight down at different frequencies, enemy 3 will fire bullets towards the main plane, enemy 4 will not fire bullets but comes from the bottom of the room and is more difficult to avoid or shoot.

Enemy 1, 2 - Shooting Straight Down

 

Create an enemy bullet. In create set the vertical speed . In the collision event of this bullet with the main plane we set the health relative to -5, destroy the bullet, and play a sound. Destroy the bullet when it leaves the room

 

Have the Enemy shoot 1 time out of 30 (Note: you could also use an alarm)
Have Enemy 2 shoot 1 time out of 50.

Feel free to modify the shooting.

 

Have

 

 

Enemy 3 - Shooting at the Main Plane

Create a different enemy bullet object. The enemy plane creates this new type of bullet in its step event. Again use the dice action but now we only create a bullet once every 80 steps, because our new type of bullet is a lot harder to avoid.

On the bullet create set the bullet to move towards the plane

 

 

 

Enemy 4 - Flying Up

Finally have your 4th enemy fly up. Spawn additional planes over time. (Change the random location x value)

 

Enemy Spawning

Using the ideas of the bombs in Fruit mania spawn more enemies over time.

 

 

 

Your Turn

Be Creative and add elements to your game. You might consider adding a turret, power ups, other enemies, a different level. It is totally up to you, there are no requirements.

 

 

Post everything to your website using the template. We will not be completing peer evaluations for this game.

Link to the Rubric