MakeCode Arcade is a fun and easy-to-use tool that lets us create our own arcade games. It's like a digital playground where we can build and play games right in our web browser.
With MakeCode, we can use colourful blocks to build our games, just like Scratch.
If you have a small handheld gaming computer like the BrainPad or GameGo, you can even put the games you make onto it and play them anywhere!
Imagine the MakeCode Arcade code editor as a magical toolbox. It's a lot like the Microbit and Scratch editors you might have used before. Here's what it has:
Let's create our first project!
Go to the Arcade MakeCode website and create a new project. You can call your project anything you want!
Create a new Arcade project using the makecode.com website.
Let's create a sprite for our game. Add the following code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
Click on the gray box in the sprite block to open the Editor. You can choose a sprite from the Gallery or you can paint your own sprite using the Editor.
Now let's design our character!
Click on the grey box in the code block, this will open up the Sprite Editor.
Use the tools to paint your own character and when you're done click on the green Done button at the bottom right of the screen. You will then see your sprite in the simulator!
Next let's add some code so that we can move our character around using the joystick (or the arrows on our keyboard).
Add the following new code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . 5 5 5 5 5 5 5 5 5 . . .
. . . 5 5 5 5 5 5 5 5 5 5 5 . .
. . 5 5 5 f 5 5 5 f 5 5 5 5 . .
. . 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .
. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 5 5 f 5 5 5 .
. 5 5 5 5 f 5 5 5 5 f 5 5 5 5 .
. 5 5 5 5 f f f f f f 5 5 5 . .
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
. . . 5 5 5 5 5 5 5 5 5 5 5 . .
. . . . . . . 5 5 5 5 5 5 . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
You might have noticed that your sprite can move off the screen if it goes far enough. Let's add some code to make it stay on the screen.
Add the following new code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . 5 5 5 5 5 5 5 5 5 . . .
. . . 5 5 5 5 5 5 5 5 5 5 5 . .
. . 5 5 5 f 5 5 5 f 5 5 5 5 . .
. . 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .
. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 5 5 f 5 5 5 .
. 5 5 5 5 f 5 5 5 5 f 5 5 5 5 .
. 5 5 5 5 f f f f f f 5 5 5 . .
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
. . . 5 5 5 5 5 5 5 5 5 5 5 . .
. . . . . . . 5 5 5 5 5 5 . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
mySprite.setStayInScreen(true)
Finally let's add an effect to your sprite!
Add the following new code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . 5 5 5 5 5 5 5 5 5 . . .
. . . 5 5 5 5 5 5 5 5 5 5 5 . .
. . 5 5 5 f 5 5 5 f 5 5 5 5 . .
. . 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 f 5 5 5 5 5 .
. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .
. 5 5 5 5 5 5 5 5 5 5 5 5 5 5 .
. 5 5 5 5 f 5 5 5 5 5 f 5 5 5 .
. 5 5 5 5 f 5 5 5 5 f 5 5 5 5 .
. 5 5 5 5 f f f f f f 5 5 5 . .
. . 5 5 5 5 5 5 5 5 5 5 5 5 . .
. . . 5 5 5 5 5 5 5 5 5 5 5 . .
. . . . . . . 5 5 5 5 5 5 . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
mySprite.setStayInScreen(true)
mySprite.startEffect(effects.spray)
Now that you've learned how to create and control a sprite in MakeCode Arcade, it's time to explore more! If you have some extra time, try to create more sprites, add different effects, or even start building your own game. Remember, the only limit is your imagination!
Great job! You've just finished your first MakeCode Arcade project. You've learned how to create a sprite, design your character, control your character, keep your character on the screen, and add cool effects to your character. This is just the beginning. There's so much more you can do with MakeCode Arcade. Keep exploring and keep coding!
Every lesson in the course is ready to teach like this one. See what else comes with it, and how to order it.