Simple Shooting Game in Arcade Makecode
by R-Z Lorinc in Circuits > Software
1741 Views, 2 Favorites, 0 Comments
Simple Shooting Game in Arcade Makecode
This is a little and simple shooting game in the arcade makecode program (arcade.makecode.com). You can download and play it for yourself (using this link). WARNING: I have no talent for creating pixel art sprites so the project is VERY UGLY, feel free to change the textures.
Supplies
The Arcade make code is an online program with a built-in emulator, so you don't need any special hardware to use it, but you can play your games on physical devices (you can see some of them in the image included. You can also use a raspberry pi 0.) more on arcade.makecode.com/hardware
Create the Project
go to the arcade makecode website and click 'new project'. You can name it whatever you want.
The Assets
You'll need 7 different assets for your project.
The first and second assets are the player and the enemy (16x16 pixels).
The third is a background image (160x120 pixels).
The fourth is a 2x6 bullet.
The fifth is an entirely white version of the player (when the player gets hit it starts flashing in this colour).
The sixth is an 11x11 loading circle animation (it will show when the player is reloading).
And lastly, the seventh is an animation that'll be played when the enemy gets hit. Make sure the last frame is the normal sprite of the enemy.
Variables
declare the variables.
Functions - Start
Lines:
1 - set the starting speed to 1
2 - create the reload animation sprite (for now, just a transparent texture)
3 - set 'loaded' to false
4, 5 - create the player and the enemy
6, 7 - position the player and the enemy
8 - set the background image
9, 10 - set life and score to start pos.
Functions - Inputs
The 'A' button makes the player shoot if he's loaded. The 'B' button makes the player reload if he's not loaded.
Functions - Shoot
We will call this function when the player is loaded and presses 'A'. It sets 'loaded' to false and creates 3 bullets.
Functions - Loops
The first loop is for input handling only. It also moves the reloading animation sprite above the player.
The second loop sets the enemy's horizontal velocity to -50, 0 or 50. It also multiplies the velocity by -1 if the enemy is at the edge of the screen.
The third loop is delayed. It makes the enemy shoot every 3000/speed ms-s.
Fuctions - Collision
If the enemy gets hit, it adds 1 to the score, plays the enemy death animation, raises the speed and positions the enemy randomly.
If the player gets hit it makes the sprite flash and makes the player lose 1 hp.
Finished Thing
Congratulations! You've made a game in the arcade makecode. Now go and make one by yourself.