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 in the familiar way. 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 bullets every second, that is, one bullet every 15 steps.

To achieve this we create our own variable called 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
- s
et 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 Alarm 0 - set can_shoot = 1, indicating that we can shoot again.

You can change the alarm to change the shooting speed.

 


 

Collision Event with the Bullet

Add sound, destroy the enemy, play an explosion, re-spawn enemy at the top of 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 to make it invisible. 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 like this:

In the collision event of the enemy plane and the main plane, change the main plane, that is, the other instance, into an explosion. Also we play the exploding sound and we destroy the enemy plane.


 

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

Create an controller_enemy object

 

 

Place one instance of the controller object in the room.

 


Scores, Lives, and 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.

 

In the create event sets the score to 0, the number of lives to 3, and the health to 100.

 

Drawing the Information Bar

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 draw event of the controller_life

- draw the panel sprite at the bottom

To make sure that the bottom panel lies above everything else we give the controller_life object a depth of –10000.


- draw the score
- draw the lives as images
- draw the health bar

 

 

 

The health is displayed in the form of a health bar. You can indicate the position, size, and color scheme used as follows:


But we still need to actually check for the health and lives. First of all we have to make some changes in the collision event of the enemy plane and the main plane. It should no longer destroy the main plane, but only destroy itself (turning it into an explosion) and decrease the health, that is, set the health relative to -30 (so it can withstand 3 hits).

The controller_life object will check when the health becomes smaller than 0. There is an event for this under the other events. In this event we blow up the main plane by turning it into a big explosion. We also reset the health and play the correct sound. So the event looks like this:

Modify the Explosion to subtract a life

Add a No More Lives object to Restart the Game

 

Adding Shooting Enemies

New Enemy 2 - Shooting Straight Down

Duplicate obj_enemy2 and modify

 

 

Create a Controller_Enemy

In the creation event we set alarm 1 to a value of 1000.

In Alarm1 we create the enemy
It there are less than 5 enemies, set alarm1 to 500 to create another enemy

 

New Enemy 3 - Shooting towards the Main Plane

Duplicate Enemy 3

Create a New Bullet that moves towards the plane

The action to move towards a point now has the following parameter:

One other change is required. As the bullet can fly in any direction it is a bit more difficult to test in the step event whether the bullet lies outside the room. But actually, there is a special event for this: the Outside event. In this event we simply put an action to destroy the object.

Create a Controller to add these planes

 

New Enemy 4 - Flying Up

Duplicate Enemy 4

Have this plane fly up from the bottom and re-spawn when it flies out the top.

Add a Controller to Randomly add these planes.

 

 

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 the following using the Template from assignment 1

.gm81 file and .exe file (embed drive folder)

Screenshots NOT required

Game Play Video

Self-evaluation form (embed form)


No Peer Evaluations

No Rubric - Evaluated for Completeness and Upgrades only Only