We present a browser version of our free PeekAMaze app that is currently available for Android phones on the Android Market. The version given here runs in a standard browser window. The complete source code for the puzzle is provided in a zip file linked below. Click the screen shot below or on this link to open the applet in a new window:
- Download all source files corresponding to this game: peekweb.zip
The zip file contains the well-commented PeekAMazeWeb.fla Flash CS5 file and a folder of custom AS3 classes: com -> flashandmath ->*.
Note: The browser version of PeekAMaze is not suitable for small touch screen devices. To play the game on your Android phone, search for flashandmath on the Android Market and choose PeekAMaze from the list of our apps.
To create the puzzle we used our custom MazeGenerator and MazeDisplay AS3 classes from our earlier renditions of the maze puzzle listed below. MazeGenerator is an easy and fast class that randomly generates a perfect maze. MazeDisplay creates a graphical representation of each maze. The code in the MazeDisplay class is very easy to customize and allows for creation of different looking mazes.
The biggest difference between the Android and the desktop versions of PeekAMaze is in the way the wheel that moves the ball functions. The wheel actually works better on a touch screen devices. The user simply moves a finger around the wheel which is very natural and easy. In the desktop version, the mouse button has to be pressed while moving the ball.
In addition, the slight jerks of the maze when the ball adjusts automatically to fit into the next corridor were hardly noticable on the phone. In the desktop version, they were unsightly. We compensated by "smoothing" the motion of the maze as the ball moves. (The ball moves throughout the maze but to keep the ball in the view window, we are, in fact, moving the maze.) We used the technique developed in our earlier tutorial Easing Without Tweens in AS3 Flash.
Other than that, the code in this version is very similar to the code in our PeekAMaze Android app. You can dowload AIR for Android code for PeekAMaze at AIR for Android PeekAMaze Game - Source Code.
Related Flash and Math Tutorials
Here are a few related tutorials about mazes and about "easing without tweens". The last two maze examples are different in nature: the user can see each maze in its entirety; there is no need to "peek".