Pixel dimensions
When using the image editor, the pixel dimensions are displayed in the lower left corner. The width is the first number and the height is the second number.
Games tell a story, and those stories require characters. In Arcade, those characters are generally represented using sprites. This activity equips students with the skills necessary to create, test and save sprites using the MakeCode development environment. Students will build unique sprites by using the sprite menu and the integrated image editor.
In this activity, students are introduced to:
||sprites:Sprites||
and ||images:Images||
||sprites:Sprite||
variable to an image using the image editorThe blocks needed to create sprites are found in the ||sprites:Sprites||
menu. The ||variables:set mySprite to||
is the first block in this category that we will discuss. The following example shows the creation of a sprite with a blank image.
let mySprite: Sprite = null
mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .
`, SpriteKind.Player)
Clicking on the image icon as shown in the video above will bring up the Image Editor, allowing you to draw an image for your own sprite.
Look at the blocks, and note that a name for the sprite (||variables:mySprite||
) is set to an image for the sprite (it’s hot sauce!).
let mySprite: Sprite = null
mySprite = sprites.create(img`
. . . . . . . . . . . . . . . .
. . . . . . . . 2 . . . . . . .
. . . . . . . 7 7 7 . . . . . .
. . . . . . . 7 7 7 . . . . . .
. . . . . . 2 2 2 2 2 . . . . .
. . . . . 2 2 2 1 2 2 2 . . . .
. . . . . 2 1 2 2 1 2 2 . . . .
. . . . . 2 2 7 7 2 2 2 . . . .
. . . . . 2 7 2 7 2 2 2 . . . .
. . . . . 2 2 2 2 7 2 2 . . . .
. . . . . 2 2 2 7 7 2 2 . . . .
. . . . . 2 1 2 2 2 2 2 . . . .
. . . . . 2 2 1 1 2 2 2 . . . .
. . . . . 2 2 2 2 1 2 2 . . . .
. . . . . 2 2 2 2 2 2 2 . . . .
. . . . . 2 2 2 2 2 2 2 . . . .
`, SpriteKind.Player)
||sprites:Sprite||
change sprite size
button to make a sprite that is 32x32 pixels