Starting from:
$35

$29

Lab #4 BUZZY (Part 1) Solution

Directions: To complete this lab you will need to demo your completed lab to one of the TAs during their office hours. You will need to compile your code and upload it to the mbed in front of the TA. The TA will need to take a quick look at your code before you compile it. Your files should have your name at the top in a comment header.

Upload to Canvas under Lab4 an image of this front page with the TA’s sign off.

Overview:

In this lab you will be creating a prototype version of the latest video gaming craze called BUZZY. It is a spin-off (only for educational purposes) of the old pacman game. You will be given sample code to help in drawing the maze and icons of Buzzy, ghosts, honey drops, power-ups, and fruit. You will be required to develop the code to draw the maze and put Buzzy and the ghosts in their default locations. You will also need to write code to move Buzzy around the maze using four push buttons (up, down, left, right). For Part 1, just draw the ghosts but do not move them. When Buzzy is moving play the default CHOMP sound. When Buzzy is stuck play the SIREN sound. When Buzzy eats a fruit, or power-up play the correct sound and then switch back to either the SIREN or CHOMP depending on what Buzzy is doing. The level is finished when Buzzy consumes all the honey drops which should start the game over from the beginning.

When Buzzy is moving there are two variables the m_CurrentDirection and the m_DesiredDirection. The m_DesiredDirection is updated using the push buttons. Every time Buzzy gets ready to make a move check to see if he can move in that direction. Buzzy must not go through walls!!!

Display text to the user to tell them to press a button to start. Wait for a button press before drawing the maze and starting the game.
Objectives:

Learn to use multi-dimensional arrays.

Learn how to create base classes and derived classes. Learn how to use timers and interrupt routines.

Equipment:

mbed - LPC1768 (Cortex-M3)

Serial Miniature LCD Module - 1.44" Speaker - PCB Mount

Transistor – NPN (2N3904) Jumper Wires

4 push buttons


Lab Hardware Setup:

    1. Setup the LCD display similar to how you set it up in Lab #2

        a. On your protoboard, please put the LCD on the side of the mbed chip where you have the pins 27-29. See the wiring table below for the pin connections needed. You might also want to read the mbed wiki page is (Please note some of the pin changes in the table in Figure 1!)
        b. https://mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/





















c.






    2. Button Setup

        a. Refer to Part 4 of Lab#2.

        b. You will need to setup four buttons for directions

            i. Up

            ii. Down

            iii. Left

            iv. Right

        c. Use the pins 16, 17, 18, 19

    3. Speaker Setup

        a. Use the same speaker setup as Part 4 of Lab #2.

        b. Use pin 21 for the speaker.


Lab Software Setup:



    1. From Lab#2 make a clone of your “JazzyTunes” project and call it Buzzy.
    2. Replace the main.cpp file with the one provided in the Lab4.zip file.
    3. Copy the rest of the files from the Lab4.zip file into the project.

Software Requirements:

I have provided a shell project that worked and then I removed parts of the code. You are free to start with the shell or create your own code from scratch. If you use the shell, a lot of the functions are empty and need to be completed. It is up to you to modify the code in any way necessary to make the game work as described in the Overview part.

Example Setup:

Opening Screen:

Buzzy in Maze:





















Grading Rubric:
Task
% Credit
Maze is drawn correctly, with Buzzy and Ghosts at
20%
starting points

Buttons change Buzzy’s direction through maze. Buzzy
5% each button (up, down, left, right)
does not go through walls.

As Buzzy moves through the maze the LCD is updated
30%
correctly

Sound changes as Buzzy moves through maze
20%
Game restarts after all honey drops are consumed.
10%
Extra Credit:

1% for each week day completed early (up to 5%

maximum)

More products