Barrel Dodger
Make an action game where the player has to react quickly to avoid fast moving barrels. Get hit and it’s GAME OVER!
Step 1
OK, let’s get started by making our Player
sprite. Start by placing a set mySprite to block in an on start block to create your sprite.
Step 2
Draw your player sprite’s image using the image editor.
Step 3
We want to put our sprite character nearer to the left side of the screen so drag a set mySprite position into on start and set x
to 20
and y
to 70
.
Step 4
Drag a set mySprite x into the on start, click the dropdown, and select ay (acceleration y)
. Set the value to 500
so that character is pulled down by “gravity”.
Step 5
Now let’s create a platform base at the bottom of the screen.
Get a set tilemap to and put it in on start.
Click on the gray box to open the tilemap editor
.
In the bottom left corner, set the size of the tilemap to 10x8
and draw a platform for in the bottom two rows of the tilemap.
Finally, click the Wall
button, and fill in those two rows with walls.
Step 6
Next, let’s have some barrels moving at random speeds. Make them start from the right side of the screen and fly towards the player sprite. Move an on game update every onto the editor and set the interval time to 1500
milliseconds. Drag a projectile from side into it. Click the empty image box in the projectile block and change the dimensions to 8x8. Draw the barrel.
After that, drag a pick random block into where vx
is and set the range from -100
to -80
.
Step 7
Find place mySprite on top of tilemap col row and drag it into the on game update interval after set projectile to. Set the col to 9 and the row to 5, which is the tile on the right side of the screen directly above the wall. Change mySprite to projectile, so that it refers to the sprite that was just created.
Step 8
Let’s give the sprite the ability to jump when we press a button. We do this with on any button pressed. Find that block and drag it out onto the editor. Change the button from any
to A
.
Step 9
We need to make sure that the sprite is on the ground before jumping, so drag an if then conditional into the on A button pressed. Replace true
with is mySprite hitting wall and change left
side bottom
. Finally, put in a set mySprite x and choose vy (velocity y) from the dropdown. Set the value to -250
.
Step 10
Each time a barrel starts to move we want to increase the score. Get a change score by and put it into on game update every. Leave the value at 1
.
Step 11
Our final step is to end the game if a barrel touches the sprite player. Drag an on sprite overlaps onto the editor. Set the sprite kind for otherSprite
to Projectile
. End the game with a game over block inside.
Complete
Awesome! Congratulations on making the Barrel Dodger game! You are on your way to making amazing games with Arcade.