Send the link below via email or IMCopy
Present to your audienceStart remote presentation
- Invited audience members will follow you as you navigate and present
- People invited to a presentation do not need a Prezi account
- This link expires 10 minutes after you close the presentation
- A maximum of 30 users can follow your presentation
- Learn more about this feature in our knowledge base article
Creating a Parallax Shooter
Transcript of Creating a Parallax Shooter
A SHOOTER GAME
What is a
In order to Create the shooter game, we will need to include variables, which will help us organize and differentiate between different sprites.
The player controls a single character that uses ammunition in order to defeat enemies moving in the direction of the player. The aim of the game is to advance further
(time or distance) through out the game and to accumulate points through destroying enemies. The background scrolls in the direction of where the player is supposed to head.
Most well know shooter game:
Space Invaders (fixed screen)
To begin the game, we have to start off with the basics.
First, we import the sprites from the resources folder which also includes the water.png file
Next we make an object for each of the sprites, which determines the action of the sprites. Along with that, import the sounds (snd_explosion1.wav and snd_explosion2.wav) for the explosions as well.
The Action/Events for the Bullets
These are for the images for the object my_plane :
And the events for the directions are pretty straight forward.
The next event is a collision with the enemy ship. Use the Sound action with one of your Import sounds. Next make your plane change sprites by the action "Change sprite into spr_explosion2". Add a a time delay (to make it more realistic) and destroy the character.
Optional: Add a high score table to make it more challenging.
In order for the enemy to appear at a random location, we need to put in variables.
We need to tell it to appear at random positions and insert another variable in order for them to do so.
When the bullet hits the enemy (UFO), you should earn points right?
So in order for that to happen, we do this....
Let's create the shooting variable. Open the player's plane object.
With the "Create" Event, click the Control tab and open the square "VAR" button. In this instance, it is named "can_shoot". It should be set to 1.
After your finish with those settings, check the visible tab and add a depth of -100, which allows the plane to move smoothly.
Add the Alarm Event and apply the same settings you did for the Create Event. This will make it so that the bullets will keep on coming.
When the y value of the bullet
reaches -16, the action
"Destroy the instance" takes place
The action "Set the score relative to 5" allows the score to increase by 5 every time an enemy is hit and destroyed by a projectile.
"Create instance" allows the object to appear on the screen. Make sure you check the relative box so that the bullet can appear continually.
If you want to make the background scroll either horizontally or vertically, select the room and click 'background' in the top left corner (while your at it, add your background image as well). At the bottom you will notice it say 'vertical speed' and 'horizontal speed'. You must set the speeds in order for the game to scroll to your specifications.
Kurt, Samony, Caroline
The action "sleep 1000 milliseconds" allows a delay time before ending the game, which gives ample time for the explosion sprite to appear.
The Alarm function is a code that tells the enemy to appear after a certain time period.
Variable "can_shoot" is adjusted to 1 when the player presses the space button. Therefore, this piece of code will only run when the player presses space. Within the code the variable resets, as indicated by the action "Set variable can_shoot to 0"
In order to make the enemy appear we need add an object called controller_enemy. In this action we can specify when the enemy should appear
This should be your final product - a fully functioning shooter game with optional scrolling.
Remember to save your work. Have fun!
When created, set the vertical speed (recommended at -8 to allow the bullet go vertically), in order for the object to move at the constant speed.
In order to make the bullet disappear after it exits the screen, the variable function must be added.
The sprites are located in the homework file - click R:, click the SJA folder, your class' folder, then the homework folder. It is named :
GM Tutorial - Scrolling Shooter. The resources folder has all the sprites required to make your game.
Here is how we named our objects and sprites.
Gamemaker must be run in ADVANCED MODE
In order for the enemy to keep coming at the object, we need to set the vertical speed to 4 under the "Create" event
Add your water background from here.
Use the rest of these settings
Remember to put all of the objects in the room.
Between this time interval, the enemies should appear.
You can make enemies appear quicker if the interval between these two numbers is smaller.
By setting speed to 0, the plane will stop upon collision.
To prevent the plane from going offscreen, collision blocks must be created.
Place these blocks around the bottom edge and sides of the room to stop the plane before it goes offscreen.
Select the direction respective to the key that is pressed
But if you need a reminder:
We recommend a speed of 4 (but if you want to change the difficulty, change the speed to your choice).
(Under file, select "Advanced Mode". Make sure it has a checkmark.)