Amazing Mazes

LiveCode Files for this Project


This stack demonstrates a useful application of detecting collisions with the "intersect" function. It also acts as a good template that can be adapted and reused in a variety of ways. It allows a single player to move an icon around the screen with four directional buttons (left, right, up, and down) which can also be controlled with the keyboard arrow keys.

The code in the card script has a custom procedure called "checkCollision" that does just that -- it checks to see if the player has collided with one of three types of screen objects. The first are barriers (titled "barrier1," "barrier2," and "barrier3"). The code prevents the player from going through any of these three barriers. The second is a yellow dot that represents a desired place to reach on the screen. When the player's icon reaches it, a message is shown to congratulate the player. The third is a red dot, which represents something to avoid (and an appropriate message is shown when the player's icon touches it).

There are many possible ways to repurpose this stack. For example, the stack could be "skinned" to show a map of Europe with the player going from city to city to explore the history of each. A barrier could be represented by mountains or the sea.

An interesting feature is that the collision objects are still detected by the code even if the objects are hidden. This has all sorts of game design potential, especially considering that the objects could be moved to new locations by other code.

So, feel free to download, inspect, use, adapt, or repurpose to suit your needs.