MakeCode Games!

A fan-made community library of MakeCode Arcade games. Visit MakeCode Arcade to make a game!

← Back to extensions

Tilemap Path

Create multi-point waypoint paths on tilemaps for sprites to follow with built-in obstacle avoidance.

follow path

Problem it solves

You want a sprite to automatically travel along a planned path from checkpoint to checkpoint, navigating around walls along the way.

What this block does

Guides a sprite through each tile location in the path at the specified speed. Note that this function pauses code execution in its current thread until the sprite arrives at the final location or stops.

The block

sprite $sprite follow path $path || at speed $speed block

Parameters

NameTypeDefaultMeaning
spriteSpritemySpriteThe sprite that will move along the path.
pathTilemapPathpathThe path object for the sprite to follow.
speednumber100How fast the sprite moves in pixels per second.

Example

let guard = sprites.create(img`.`, SpriteKind.Enemy)
let myPath = TilemapPath.create_path([tiles.getTileLocation(2, 2), tiles.getTileLocation(8, 2)])
TilemapPath.follow_path(guard, myPath, 60)

Add the extension

Add github:UnsignedArduino/TilemapPath to your project, or open: Import TilemapPath.