stop when colliding
Problem it solves
You want an NPC, a heavy boulder, or an enemy to act like a solid wall so the player cannot walk straight through them.
What this block does
Sets up continuous collision checking between two sprites or sprite kinds so that the first sprite stops completely upon hitting the second sprite, treating it like a solid obstacle.
The block
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| spriteA | Sprite | number | mySprite | The moving sprite or SpriteKind that should be stopped. |
| spriteB | Sprite | number | myEnemy | The obstacle sprite or SpriteKind acting as a solid wall. |
Example
let player = sprites.create(img`.`, SpriteKind.Player) let guard = sprites.create(img`.`, SpriteKind.Enemy) controller.moveSprite(player) CollisionHandler.handleSolidCollision(player, guard)
Add the extension
Add github:Sonicblaston62/Sprite-Walls to your project, or open: Import Sprite-Walls.