MakeCode Games!

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

← Back to extensions

Sprite Walls

Add solid wall collisions and pushable block physics between sprites or sprite kinds without needing tilemap walls.

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

allow $spriteA to push $spriteB in $direction block

Parameters

NameTypeDefaultMeaning
spriteASprite | numbermySpriteThe sprite or SpriteKind doing the pushing (like the player).
spriteBSprite | numbermyEnemyThe sprite or SpriteKind being pushed (like a crate or rock).
directionPushDirectionCollisionHandler.PushDirection.OmnidirectionalThe 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.