Overview
Zinnia demonstrates how to create a basic multi-level maze game in Scratch by guiding viewers through designing a maze, coding character movement, adding wall collision, and setting up level progression.
Step 1: Creating the Maze and Character
- Choose a main character sprite by clicking "choose a sprite" and adjust its size if needed.
- Switch to the stage and use the backdrops tab to draw maze walls with the rectangle tool.
- Select a wall color and arrange rectangles for maze layout.
- Draw an exit using a different color and position it as desired.
Step 2: Coding Character Movement
- Click on the character sprite and go to the code tab.
- Use "move 10 steps" blocks and "point in direction" blocks to control movement.
- Assign arrow keys (up, down, left, right) to move the character in corresponding directions.
- Adjust rotation settings to "left-right" so the sprite does not flip upside down when moving up or down.
Step 3: Preventing Wall Collision
- Use the "touching color" sensing block to detect wall collisions based on wall color.
- When touching a wall, move the character backward by using a negative "move steps" block.
- Place the collision check within a forever loop to ensure continuous detection.
- Test the maze to ensure the character cannot move through walls and passageways are wide enough.
Step 4: Adding Multiple Levels
- Duplicate the existing backdrop to create a new maze and modify it to make a new level.
- Offer a tip: holding shift while rotating a sprite rotates it by 45° increments.
- Program the character to start at a specific position and on the correct backdrop when the green flag is clicked.
- Use the "touching color" block to detect when the character reaches the exit door color.
- On touching the exit, reset the character to the start position and switch to the next backdrop (level).
Recommendations / Advice
- Adjust the character’s starting position and maze complexity to fit your game's needs.
- Test maze walls and passage sizes for playability.
Questions / Follow-Ups
- Consider enhancing the game further with timers, scores, or additional features in the future.