Welcome to the 'Fruit Frenzy' lesson! In this fun and interactive lesson, you will create a game called 'Fruit Collector' using MakeCode Arcade. You will control a character to collect falling fruits and dodge harmful rocks. You will learn about game loops, character controls, collision detection, and scoring. Let's get started!
Open the MakeCode Arcade website using the link below and create a new project. You can call the project whatever you want.
Create a new Arcade project using the makecode.com website.
Let's create the player character.
Add the following code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . 7 7 7 7 7 7 . . . . .
. . . . . 7 7 7 7 7 7 7 . . . .
. . . . 7 7 5 5 7 5 5 7 7 . . .
. . 7 7 7 7 5 5 7 5 5 7 7 . . .
. . 7 7 7 7 5 5 7 5 5 7 7 7 . .
. . 7 7 7 7 5 5 7 5 5 7 7 7 . .
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
. . 7 7 5 5 5 5 5 2 2 5 5 7 . .
. . . 7 7 5 5 5 5 2 2 5 5 7 . .
. . . 7 7 5 5 5 5 5 5 5 7 7 . .
. . . . 7 7 5 5 5 5 5 5 7 . . .
. . . . . 7 7 7 5 5 5 7 7 . . .
. . . . . . 7 7 7 7 7 7 . . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
Then either design a character or choose one from the gallery.
In this step, we'll position the sprite at the bottom of the screen and allow the player to move it left and right (but not up and down).
Add the following new code:
let mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . 7 7 7 7 7 7 . . . . .
. . . . . 7 7 7 7 7 7 7 . . . .
. . . . 7 7 5 5 7 5 5 7 7 . . .
. . 7 7 7 7 5 5 7 5 5 7 7 . . .
. . 7 7 7 7 5 5 7 5 5 7 7 7 . .
. . 7 7 7 7 5 5 7 5 5 7 7 7 . .
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
. . 7 7 7 7 7 7 7 7 7 7 7 7 . .
. . 7 7 5 5 5 5 5 2 2 5 5 7 . .
. . . 7 7 5 5 5 5 2 2 5 5 7 . .
. . . 7 7 5 5 5 5 5 5 5 7 7 . .
. . . . 7 7 5 5 5 5 5 5 7 . . .
. . . . . 7 7 7 5 5 5 7 7 . . .
. . . . . . 7 7 7 7 7 7 . . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
mySprite.y = 110
controller.moveSprite(mySprite, 100, 0)
set block.move blockYou're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.