Block puzzle: first prototype


I’m using SpriteKit. The built-in physics engine made this pretty painless. Making a block draggable is just a matter of tracking the touch movement, and updating the block’s position, then letting the physics world push back if the block is moving into a wall or another block.

The trickiest part was letting you move a block by dragging another block into it. In this case, you want all of the affected blocks to respond to your finger. But in the standard physics world, the other blocks essentially “push back” against your finger. A bit of custom logic was required to circumvent this.

Leave a Reply

Your email address will not be published.