This maze game implements a portion of a Pacman game board:
The arrow keys are used to control the Pacman sprite.
Here's a link to a Word document that provides an overview of game mechanics:
Has anyone connected a bluetooth joystick controller to a PC and used it with Snap! ?
If anyone has suggestions or recommendations for a bluetooth game controller, I'll update the game to make use of a joystick as a controller.
In the past, I tried several solutions:
-Advance, detect if there is a collision with a wall, retreat
- Detector: like a blind cane
-Grid: all possible positions in a variable
Have you tried other approaches?
I noticed a small bug: the first pill is never displayed: just moving the SHOW block a little higher in the script...
I made a remix:
- movements a little more fluid
- game over at the end
- better chomp sound rendering
Love the enhancements! The "Game Over" display at the end really pulls it together.
I originally explored use of classic maze following behavior, but decided that a grid worked better in this situation. A couple of enhancements that might be useful could include: (1) adjusting the speed of the ghost chasing the Pacman to reflect the skill and dexterity of the player, and (2) provision of additional levels if the first level is cleared.
I primarily did this to get a sense of what might be involved in creating a maze game of this sort, with goal of generating some general guidelines that could be used to facilitate invention of original maze games in Snap! If there has been other work describing general strategies for developing maze games in Snap!, I would be interested in reading about it.
i think you should include the maze design code (if you don't discard it)
The code used to build the maze is still in the file. A procedure, Build Game Board, uses two subprocedures, Box and Walls, to draw the game board. The Box procedure draws a box around the game board. The Walls procedure draws the walls within the box.
A procedure, Record Grid Positions, was used to record a list of all the positions on an 9 x 9 grid spaced 25 steps apart. (This procedure uses a global variable, "List of Positions", that was subsequently deleted, so this variable would need to be recreated before running the procedure.)
The result was saved in a reporter block, Grid Locations:
The Wall Locations were then removed from the Grid Locations to create a reporter block, Path Locations, with a list of all of the valid path locations:
The Path Locations reporter block is used to determine where the Pacman is allowed to travel.
This initial setup enabled me to create a prototype to see if this approach would work. If different levels were created, it might be nice to generate the game board using an algorithm rather than manually.
Oh, sorry, i don't see it !!!
I have an idea for future levels... let me test something...
Looking forward to your thoughts on future levels.
Most of the blocks described above are in the Motion palette:
The remaining reporter blocks are in the Variables palette:
Did you experience any sound issues? After 1 or 2 completed stage, no sound in the sptite pac-man...
Maybe because constantly playing the chomp sound?
I did not encounter a problem with sound, but I did not play past the first stage.
I wonder if there's a cache that needs to be cleared, or if there's a way to initialize sound at the beginning of every stage?
i will look at this problem later, thk
Here's the new version ! (V2)
- Add "level" functionality
- You can draw your own level
- New block to draw level:
Draw wall (cartesian version)(-4 to +4 = 9X9 grid)
- After all levels, you fight against 2 ghost
- Snap to grid improvement (new block to
do the job)
- Sound problems after a few levels : crash of the play sound block, i think it is a Snap! bug...
This is nice ... a lot of fun to play!
We're planning to work on addition of a joystick controller next week. We got it semi-working on Friday, but there were latency issues, so it wasn't very smooth. Hopefully we can improve the responsiveness of the joystick when we take another look at it. We'll post details if we make any progress.
It seems that the MB KeyPress sends a key-down report immediately followed by an key-up.
So any project that pulls a keyboard state with , may not work reliably.
We're planning to work on some MicroBlocks documentation to support use of an arcade joystick with Snap! games. Once we have a draft, we'll post here for review.