MakeCode Games!

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

← Back to extensions

Tilemap A* Pathfinding

Smart pathfinding for tilemaps that lets sprites calculate routes around walls and follow paths automatically.

percent sprite path completion

Problem it solves

You are building a tower defense game or racing game and need to know how far along the track an enemy or racer has traveled.

What this block does

Returns an estimated completion percentage between 0 and 100 for the sprite's current path. If the sprite is not currently following a path, this returns 100.

The block

percent sprite $sprite path completion block

Parameters

NameTypeDefaultMeaning
spriteSpritemySpriteThe sprite to check path progress for.

Returns

number — A percentage from 0 to 100 showing how much of the path has been traversed.

Example

let mySprite = sprites.create(img`.`, SpriteKind.Enemy)
let progress = scene.spritePercentPathCompleted(mySprite)
mySprite.sayText(progress + "%")

Add the extension

Add github:jwunderl/arcade-tilemap-a-star to your project, or open: Import arcade-tilemap-a-star.