Forum Discussion

OwenHolt's avatar
OwenHolt
Super Hero
8 years ago

Sliding Puzzle Game

Background: For the Austin Articulate Roadshow session, I developed a simple "sliding puzzle" game to demonstrate the logic used by StoryLine triggers. The file uses variables, triggers, motion paths, and 1 tiny (easy to understand) piece of JavaScript. I also show in the video how I use other tools like Excel to explore and essentially "storyboard" my logic.

How the published game works: Click a piece next to the open/empty space and the piece will slide over to occupy that space. Only pieces adjacent to the empty space can move. Keep sliding pieces around to unscramble them into the proper picture.

How the mechanics work: Each piece has 4 motion paths and 1 variable to track its current position on the board. The empty space also has a "position" variable and there is one additional "control" variable. When you click a piece, a quick bit of math is performed to determine the distance between the piece and the empty space and the result is sent to the control variable. A piece will move along the appropriate motion path IF the control variable is equal to certain values (as explained in the video). 

Simple enough? Enjoy!