Rosie Gillman
Dependencies: mbed Gamepad2 ELEC2645_Project_el18rg
Dependents: ELEC2645_Project_el18rg
Rosemary Gillman 201265952
Objective
The goal of the game is to splat the bug as fast as you can using the swatter.
Controls
1 - Joystick - left/right to control the swatter 2 - Start button - starts the game 3 - Reset - resets the game 4 - Volume pot - adjusts the volume
Instructions
- Turn the gamepad on
- Wait for start screen and press start
- Move the joystick to control the swatter
- Splat the bug as fast as you can
- Press reset to play again
Gameplay
Start Screen 1
- Low pad tone plays for 0.5s
- Pad lights flash (200ms on/200ms off)
- Text saying "Bug Splat Leeds Edition" is displayed
- After 5 flashes the screen changes to Start Screen 2
Start Screen 2
- Pad lights stay on constantly
- Text reads "Splat the bug as fast as you can! Press start"
- When start is pressed the screen changes to Gamplay Screen
Gameplay Screen
- The timer begins
- Bug appears in the top right corner
- Swatter appears in the bottom left corner
- The bug bounces (with random velocity/direction) off the sides
- When the bug bounces off the wall a low pad tone is played each time for 0.1 seconds
- Swatter is controlled left to right with the joystick
- When the bug and swatter overlap the screen changes to the Ending Screen
Ending Screen
- Low pad tone plays for 0.5s
- The timer ends and its value is displayed
- Text reads "SPLAT (time) secs"
- Splats are drawn on the screen
Swatter/Swatter.h@12:a8196d72a3e7, 2020-05-28 (annotated)
- Committer:
- el18rg
- Date:
- Thu May 28 21:20:47 2020 +0000
- Revision:
- 12:a8196d72a3e7
- Parent:
- 11:93da75c1849d
- Child:
- 14:9b4a219dd91e
Neaten 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el18rg | 10:b6e45e4acde7 | 1 | #ifndef SWATTER_H |
el18rg | 10:b6e45e4acde7 | 2 | #define SWATTER_H |
el18rg | 10:b6e45e4acde7 | 3 | |
el18rg | 10:b6e45e4acde7 | 4 | #include "mbed.h" |
el18rg | 10:b6e45e4acde7 | 5 | #include "Gamepad.h" |
el18rg | 10:b6e45e4acde7 | 6 | #include "N5110.h" |
el18rg | 11:93da75c1849d | 7 | |
el18rg | 11:93da75c1849d | 8 | class Swatter |
el18rg | 11:93da75c1849d | 9 | { |
el18rg | 11:93da75c1849d | 10 | public: |
el18rg | 11:93da75c1849d | 11 | Swatter(); |
el18rg | 11:93da75c1849d | 12 | ~Swatter(); |
el18rg | 11:93da75c1849d | 13 | void init(int x,int height,int width); |
el18rg | 11:93da75c1849d | 14 | void draw(N5110 &lcd); |
el18rg | 11:93da75c1849d | 15 | void right_control(Gamepad &pad); |
el18rg | 11:93da75c1849d | 16 | Vector2D get_pos(); |
el18rg | 11:93da75c1849d | 17 | void left_control(Gamepad &pad); |
el18rg | 11:93da75c1849d | 18 | void boundries(); |
el18rg | 11:93da75c1849d | 19 | void update(Direction d,float mag); |
el18rg | 11:93da75c1849d | 20 | void controlv2(Gamepad &pad); |
el18rg | 11:93da75c1849d | 21 | void control(Gamepad &pad); |
el18rg | 11:93da75c1849d | 22 | |
el18rg | 11:93da75c1849d | 23 | private: |
el18rg | 11:93da75c1849d | 24 | float x_Swatter; |
el18rg | 11:93da75c1849d | 25 | int y_Swatter; |
el18rg | 11:93da75c1849d | 26 | int direction; |
el18rg | 11:93da75c1849d | 27 | int _height; |
el18rg | 10:b6e45e4acde7 | 28 | int _width; |
el18rg | 10:b6e45e4acde7 | 29 | int _x; |
el18rg | 10:b6e45e4acde7 | 30 | int _y; |
el18rg | 10:b6e45e4acde7 | 31 | int _speed; |
el18rg | 10:b6e45e4acde7 | 32 | }; |
el18rg | 10:b6e45e4acde7 | 33 | #endif |