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
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| sprite | Sprite | mySprite | The 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.