Learn how Phaser manages draggable objects

Article by Richard Davey. Posted on 28th Aug 2015.   @phaser_


"The goal of the game is to get the red car out of a six-by-six grid full of automobiles by moving the other vehicles out of its way. However, the cars and trucks (set up before play according to a puzzle card) obstruct the path which makes the puzzle harder.

This is the perfect game to create to show you the features Phaser puts at our disposal when it’s time to drag objects. You can define a sprite to be draggable, lock it on an axis, make it snap to a grid when you drag it or when you release it, define a bounding box which the sprite cannot cross while dragging, and there are events to trigger functions when you start and stop dragging."

Read full Tutorial