Simple Shooting Game in Arcade Makecode

by R-Z Lorinc in Circuits > Software

1529 Views, 1 Favorites, 0 Comments

Simple Shooting Game in Arcade Makecode

arcade-shooter.png

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

kép_2023-02-18_144658888.png

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

kép_2023-02-18_145253462.png

go to the arcade makecode website and click 'new project'. You can name it whatever you want.

The Assets

kép_2023-02-18_145553178.png
kép_2023-02-18_145911446.png

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

kép_2023-02-18_155405818.png

declare the variables.

Functions - Start

kép_2023-02-18_155011949.png

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

kép_2023-02-18_161130606.png

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

kép_2023-02-18_155809125.png

We will call this function when the player is loaded and presses 'A'. It sets 'loaded' to false and creates 3 bullets.

Functions - Loops

kép_2023-02-18_155543603.png
kép_2023-02-18_155619302.png
kép_2023-02-18_155642942.png

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

kép_2023-02-18_161405351.png
kép_2023-02-18_161424798.png

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

kép_2023-02-18_162035640.png

Congratulations! You've made a game in the arcade makecode. Now go and make one by yourself.