Scrolling Planes

 

 

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 sea we need a background image that looks like a sea 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 room 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 to do this on a Step.

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:

Repeat for the other islands


 
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.

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.

 

 

Repeat for the other keys

Note: Right will be x is smaller than 500 jump to position (+4,0)

For y use 40 and 440 as your values

 

 

 

 

Enemies

Add the enemy planes. Three fly down and one flies up.(I know ..... boring, we will make it more complicated later)

Create - set the vertical speed, jump random

Step - check if outside the room and respawn

 

Collision with the Main Plane

You will need an explosion sprite and an exploding sound.

In the explosion Animation end
Destroy the instance.
Sleep a while to make sure that the exploding sound is finished.
Show the high-score table.
Restart the game.

Later we will give the main plane damage.

 

Paint Ball Bullet

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 and set the 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 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
(one from each side)
- set the variable can_shoot to 0 indicating that we can no longer shoot
- set alarm0 to 15 and on alarm ) set can_shot back to 1

 

 

 

Collision Event with the Bullet

Play a sound, create an explosion at (0,0) relative, destroy the bullet, destroy the enemy, respawn the enemy off the screen at a random location and add to the score.

 

 


Spawning Enemy Planes

 

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

Create an obj_spawnEnemies.

In Create

Set alarm0 to 200

Set alarm1 to 500

In the alarm0 create an instance of enemy1 and jump it to a random location off the screen (you may not need to jump if you did it in your enemy)

 

In the alarm1create an instance of enemy2and jump it to a random location off the screen

Repeat for the remaining enemy planes.


Scores, Lives, and Damage

Damage

To make the game a bit more interesting we will let enemies create damage on the main plane. 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.

Create a sprite of the panel
It will show the score, the damage (ie: health), and the number the number of lives.

Create a new object called the obj_controlLives. It does not need a sprite.
Set the depth to –1000.

In Create

Set the score to 0, the number of lives to 3, and the health to 100.

In Draw

Draw the panel sprite at the correct position using the action to draw a sprite.

I put mine at the bottom (x=0, y=404)

 

Draw the score, healthbar and lives in the right spot

Draw a Health Bar that is 100 wide and 10 high

 

Collision Event with the Enemies


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

No More Health

Reset the health to 100, explode the main plane, subtract a life

Animation End (of the Explosion)

D
estroy the explosion, create a new plane and subtract a life

No More Lives

Destroy the plane (explosion)

Show the high-score list and restart the game.


 

 

Enemies Shooting

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 object for each plane.

In create
Set the vertical speed .

In collision event of this bullet
Set the health relative to -5, destroy the bullet, and play a sound.
Destroy the bullet when it leaves the room

Enemy Step event

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.

 

 

 

 

Enemy 3 - Shooting at the Main Plane

 

On the bullet create set the bullet to move towards the plane.
Everything else is the same.

 

Use the dice action in the step of the plane but only create a bullet once every 80 steps, because our new type of bullet is a lot harder to avoid.

 

If you have extra time add extras to your game

 

 

Posting your Work

1. post the .exe and .gm81 files

2. post the game play video

3. Post the objects and spites list

4. Complete the Personal Evaluation

No Level screen shots or Peer Evaluations are required

This project will be marked on completeness only.

Do you have everything required?

There is no Rubric