Welcome to the Beetle in a Maze project! Over the next two activities, we will program a beetle sprite to navigate through a maze. In this first activity, we will set up the maze and give the beetle its movement controls.

Setting Up
- Open PictoBlox and create a New File.
- Select Block Coding as the coding environment.
- Add a maze backdrop from the backdrop library or draw one using the paint editor.
- Add a Beetle sprite (or any bug-like sprite) from the sprite library.
- Position the beetle at the entrance of the maze.
Programming the Movement
We will control the beetle using the arrow keys. Each key press will move the beetle a small number of steps in the corresponding direction. You will find the blocks in the mentioned palettes:
- When (right arrow) key pressed — Events: Point in direction 90, Move 5 steps
- When (left arrow) key pressed — Events: Point in direction -90, Move 5 steps
- When (up arrow) key pressed — Events: Point in direction 0, Move 5 steps
- When (down arrow) key pressed — Events: Point in direction 180, Move 5 steps

Setting the Starting Position
- Add a 'When flag clicked' block.
- Connect a 'Go to x: () y: ()' block with the coordinates of the maze entrance.
- Add a 'Point in direction 90' block to ensure the beetle starts facing right.

Testing the Movement
- Click the green flag to start.
- Use the arrow keys to move the beetle around.
- Make sure the beetle moves smoothly in all four directions.
- Try navigating through the maze manually!
Save your file with the name Beetle in a Maze before moving on to Activity 2!

.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)
.webp&w=3840&q=75)