allow to push
Problem it solves
You are building a puzzle game where the player needs to push crates, boulders, or blocks around the screen without passing through walls.
What this block does
Allows one sprite or sprite kind to push another sprite when they collide. The pushed sprite will stop automatically if it runs into a wall tile or the edge of the map.
The block
Parameters
| Name | Type | Default | Meaning |
|---|---|---|---|
| spriteA | Sprite | number | mySprite | The sprite or SpriteKind doing the pushing (like the player). |
| spriteB | Sprite | number | myEnemy | The sprite or SpriteKind being pushed (like a crate or rock). |
| direction | PushDirection | CollisionHandler.PushDirection.Omnidirectional | The direction the sprite can be pushed: X_Axis, Y_Axis, or Omnidirectional. |
Example
let player = sprites.create(img`.`, SpriteKind.Player) let box = sprites.create(img`.`, SpriteKind.Food) controller.moveSprite(player) CollisionHandler.handlePushableCollision(player, box, CollisionHandler.PushDirection.Omnidirectional)
Add the extension
Add github:Sonicblaston62/Sprite-Walls to your project, or open: Import Sprite-Walls.