Dance Party
Press the arrow keys that match the ones appearing in blocks on the screen. When your player collides with an arrow block you will get points. Try to beat your high score and dance away!

Learning Objectives
Learn the basics for a collision based game!
- The concept of sprite
- How to set up a tilemap and scene
- Spawning and destroying projectiles
- Setting and moving a character
- Setting a score increment
- Creating particle effects
- Random generation
Lesson Sections
Part One: Setting the Scene
Go to the MakeCode Arcade editor and select New Project to create a new game.
Once the editor loads, you will see a green on start block already in the editor Workspace.
To create a world for the game to exist in, we will use a tilemap.
To do this, go into scene and grab a set tilemap to block and drag it into on start.
Open the tilemap editor by clicking on the gray box in that block.
In the tilemap editor, we can create a level for the game.
First, set the size of the world to 10x8 in the bottom left corner; this will make the map approximately the same size as the screen.
Next, draw a line across the bottom with a tile that will be the bottom wall.
Fill in the rest of the screen with a background of your choice.
Finally, click on the Draw Walls
button, and draw another line at the bottom of the screen;
this will give those tiles a red tint,
indicating that they will be walls that block sprites from moving past them.
To make the background less plain you can add some scene effects.
Get a start screen effect block from Scene to do this.
Go to the drop down in the block and select star field to create an outer space theme.

Congratulations! You have now set the scene for your game.
Part Two: Creating the Sprite
To set the sprite grab a set mySprite to sprite of kind player from Sprites and drag it into on start. Now right click on mySprite
and select rename variable in the menu. Rename your sprite to whatever you would like to call your player. In the sprite of kind player block, select the grey square and draw an image of your player.
Now we want to set our sprites starting position. To do this go into sprites and grab set mySprite position to x y and drag it under sprite of kind player. Set the x
position to 80 and the y
position to 100.
Part Three: Move the Player
Our next step is to create a player that can move strictly between four spots. To do this go to Controller and grab on button pressed and drag it into your workspace. Then in the first drop down list select right. Now grab a set mySprite position to x y and under the drop down select your sprite. For the x
value type in 130 and then for the y
value type in 100.
Select the on button pressed that contains the set mySprite position to x y and duplicate it 3 times. For each of the new copies, set one to up
, the other to down
, and the third to left
. Because we want the y
variable to remain the same, only change the positions for x
.
- Up: x = 60
- Down: x = 100
- Right: x = 130
- Left: x = 30
Now you should have four Controller blocks that look like this.

Part Four: Setting Speed Variables
To get started with our speed variables, drag a set var to and drag it into on start. Rename the variable to speed and set it to 40
.
Changing Speed
We can increase the speed at which projectiles fall. To do this go to on game update every ms and drag it into workspace. Then change the number to 2000 ms
. Go to Variables and select change by and drag it into on game update. Select the drop down and choose the speed variable. Now every two seconds, the projectile speed will increment by 1.
Part Five: Spawning Projectiles
Every half a second we want the projectiles to spawn. So go into Game and grab on game update every ms and place it in your workspace. Set the interval time at 500 ms
. Next, we want to choose which “lane” to spawn our projectile in. We’ll need a lane variable for this. To create this variable, go into Variables and click on Make a Variable. Set the name of the new variable as lane
. Drag the set lane to block into on game update every ms. Grab a pick random from Math and place it after the to in our set lane to. Set the first number to 1
and the second to 4
in pick random.
Now we want to create the projectiles for each lane. Grab an if then else if block from Logic and place it under the lane
variable. Then from Logic take a _ = _ block and place it in the first if then statement. Now drag a lane block and put it in the first section and type 1
in the second section. Duplicate this equal statement 3 times and set each second section to 2
, 3
, and 4
respectively. Click the (+) symbol twice in the if else statement block and drag these equal statements into the else statements.
Now grab 4 set mySprite to sprite of kind and drag one into each of the 4 positions in the if statement. Set each variable for each if statement like this:
- For 1 the variable name is Left
- For 2 the variable name is Up
- For 3 the variable name is Down
- For 4 the variable name is Right
According to the variable names, select the grey box and draw an arrow pointing the direction of the variable name. Set each kind to a projectile.
Earlier we created a speed variable. This will now determine the speed that the projectiles spawn at. Grab a set mySprite velocity to and drag it into each of the 4 positions on the if statement. Match the mySprite
to the variable of the if statement and then set vx
to 0
and drag the speed variable from Variables into the vy position. Repeat for all sections.
From Sprites grab a set position to block for each of 4 sections of the if statements. Put them at the end of each section. Switch the mySprite
variable to match the direction variable for the if statement and set y
to 8
. Now set the x
positions to these values:
- Left: 30
- Up: 60
- Down: 100
- Right: 130
Congrats, now we can spawn projectiles!

Part Six: Setting Score and Creating Collisions
Setting Score and Setting Lives
In our game we want the player to have a score for the number of projectiles they destroy and then we want the player to have multiple lives in case they miss blocks. To do this go into info and drag set score to into the on start block. Then grab a set life to and drag it below the set score to. Now change the number in set life to to 5 so that the player can miss five projectiles before the game ends.
When the player runs out of lives the game should end and the player’s score should be displayed. To do this, go to Info, grab on life zero, and drag it into your workspace. Then go to game and grab game over lose. Drag it into on life zero. Click on the lose
button so it switches to win
and then click the (+) symbol. When you click the (+) you should have the option to select an effect. Select the confetti
effect.
You have now set up the basis of the scoring system!
Handling Collisions
When a projectile hits the bottom wall, we want that to be a collision and to have the player’s lives decrease by one. To add this feature, go into Scene and select on sprite of kind hits wall and drag it into your workspace. Now set the kind to be projectile
.
Now go into Sprite, select destroy mySprite, and drag it into on sprite of kind hits wall. Drag the sprite variable from the event block and replace mySprite with it. Then, click the (+) symbol, select the fire
effect, and set the time to 100 ms
. Drag out a change life by and put it under destroy sprite with effect. Set the number to -1
. Now whenever a projectile collides with the bottom, it will be destroyed and the player’s remaining lives will go down.

When the player collides with a projectile, their score should increase and the projectile should be destroyed. Go to Sprites and grab on sprite of kind player overlaps otherSprite of kind and drag it into your workspace. Change the field after otherSprite
from player
to projectile
. Now go back into Sprites and drag destroy mySprite into it. Pull the otherSprite variable from the event block over the mySprite variable to replace it. Click the (+) symbol, set the effect to disintegrate
, and and enter 100 ms
. Now go to Info and grab change score by and drag it under destroy otherSprite with effect.

And now we have a fully functioning game!
Final Game
