Kiki’s Corner
Published in

Kiki’s Corner

Working with Groups of Objects in MakeCode Arcade

See my game here: https://makecode.com/_CpxKbgY4uFw2

Whether you’re working with sprites or tiles, Microsoft MakeCode Arcade gives you options for referring to objects of the same type.

Sprites of a Feather

Sometimes, you want all of your sprites of one kind to have similar actions or properties. When this is the case, make sure you first give all of those sprites the same “kind.” This will help you direct them as a group later in the program.

Set the sprite’s kind to whatever makes sense

By referring to your sprites by kind, you can direct code to run each time a sprite from that group is created:

This sets the acceleration, velocity, and animations for an Enemy as they’re created

Or you can make something happen when those sprites overlap something else in the game:

This gives you a point when your Projectile overlaps any Enemy

Or, you can loop through all sprites of that group and do something to each of them:

This loops through each Enemy sprite and makes it bigger

All the Tiles

It can be just as fun to work on groups of tiles! You can detect overlaps or loop through an array of tiles as well…and it’s even easier because you don’t need to set the kind — you only need to choose the picture associated with all of the tiles you want to affect.

This will cause you to win the game when you overlap any chest tile
This will loop through all square purple tiles and replace them with coins

Now that you know how to make great things happen in mass, what will you create?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kiki Prottsman

Kiki is an author, educator, and the Director of Education for Microsoft MakeCode