Step 8: Run Your Program and Try Other Features

Your program is finished and ready to run. You can run your program and test it. To learn more, try changing the colors and sounds.

link to videoFor a video version of this topic, see Tutorial 2: Create a Maze in Visual Basic - Video 5 or Tutorial 2: Create a Maze in C# - Video 5.

To run your program

  1. Save your program, and then start it.

  2. Be sure your mouse pointer is positioned at the beginning of the maze.

  3. Move your mouse pointer through the maze. Touch a wall, and be sure a sound plays and the mouse pointer is sent back to the start.

  4. Move your mouse pointer outside the maze. Then, move the mouse pointer back into the panel, and verify that the mouse pointer is sent back to the start.

    Note

    When testing, you need to be sure that everything in the program works. You want to test to be sure that the Finish label MouseEnter event handler plays the Tada sound, opens a congratulatory message box, and closes the game. To avoid going through the entire maze, you can temporarily turn off the panel's MouseEnter event handler. That way, you can move your mouse pointer outside of the maze and position it on the Finish label without being sent back to the starting point.

  5. Select the panel, and then go to the event table in the Properties window. Scroll down to the MouseEnter event and select the event name.

  6. Press DELETE to delete the event handler name, and then press ENTER. The IDE automatically disconnects the event handler from the panel. The walls are still connected, but now you can move your mouse outside of the maze to get to the Finish label at the bottom.

  7. Save and run your program, and be sure the Finish label plays the sound, shows the message box, and closes the game. After you're sure it works, enable the panel's MouseEnter event handler by selecting it, going to the event table in the Properties window, scrolling down to the MouseEnter line, and selecting wall_MouseEnter from the drop-down list.

To try other features

  • Replace the sounds in the game with sounds you like better.

  • Set it up so that the game only plays a sound when the mouse pointer hits a wall, but doesn't play a sound when the program starts.

  • Instead of closing the program when the player wins, have the pointer move back to the starting point.

  • Change some of the wall colors and make the game play different sounds with different wall colors.

To continue or review