
Joe Body 201215898
Dependencies: mbed
Navigation
- From the Main Menu the A button will take you into one of the play, highscore or instructions options.
- The B button will return you to the Main Menu from either the highscore or instruction screens, though this is prompted on screen.
- When in the Main Menu Pot1 can be used to adjust the contrast and the volume control by the speaker is active.
- When the game is over the B button can be used to return to the Main Menu, again this is prompted.
- To return to the Main Menu while the game is being played the reset button must be pressed, this will not save your score or anything about the game.
In Game
- While in the game the A button is used to shoot while you aim with the Joystick.
- You have control over the cross while the objective of the game is to rack up as many points shooting the moving head.
- There is a slight reload time on each shot so you are unable to spam A if you miss.
- Once you miss 6 times the game will end and your score will be saved.
- When hit by a falling spike the game will transition and the head will vanish.
- 4 new spikes will spawn which you need to avoid, being hit by 1 of these will decrease your remaining miss chances by 5.
- When the game is in this state you must avoid these spikes by tilting the device, the Joystick will have no effect.
- The head will move progressively faster as the game goes on, make use of the clock power up by shooting it when it appears, this will slow the head down to a more manageable level hopefully helping you to reach a higher score.
Highscore
- If you have a SD card inserted into the device the game can save your highest score.
- A decent score is somewhere around 25.
Heston/Heston.h@23:0e8155320571, 2020-05-24 (annotated)
- Committer:
- el18jgb
- Date:
- Sun May 24 11:24:57 2020 +0000
- Revision:
- 23:0e8155320571
- Parent:
- 20:6db651a3cfec
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el18jgb | 2:56b31902c800 | 1 | #ifndef HESTON_H |
el18jgb | 2:56b31902c800 | 2 | #define HESTON_H |
el18jgb | 2:56b31902c800 | 3 | |
el18jgb | 2:56b31902c800 | 4 | #include "mbed.h" |
el18jgb | 2:56b31902c800 | 5 | #include "N5110.h" |
el18jgb | 2:56b31902c800 | 6 | #include "Gamepad.h" |
el18jgb | 2:56b31902c800 | 7 | |
el18jgb | 20:6db651a3cfec | 8 | /** Heston class |
el18jgb | 20:6db651a3cfec | 9 | * @brief moving sprite to be shot |
el18jgb | 20:6db651a3cfec | 10 | * @author Joe Body, University of Leeds |
el18jgb | 20:6db651a3cfec | 11 | * @date May 2020 |
el18jgb | 20:6db651a3cfec | 12 | */ |
el18jgb | 2:56b31902c800 | 13 | |
el18jgb | 2:56b31902c800 | 14 | class Heston |
el18jgb | 2:56b31902c800 | 15 | { |
el18jgb | 2:56b31902c800 | 16 | |
el18jgb | 2:56b31902c800 | 17 | public: |
el18jgb | 20:6db651a3cfec | 18 | |
el18jgb | 20:6db651a3cfec | 19 | /** Constructor */ |
el18jgb | 2:56b31902c800 | 20 | Heston(); |
el18jgb | 20:6db651a3cfec | 21 | |
el18jgb | 20:6db651a3cfec | 22 | /** Destructor */ |
el18jgb | 2:56b31902c800 | 23 | ~Heston(); |
el18jgb | 20:6db651a3cfec | 24 | |
el18jgb | 20:6db651a3cfec | 25 | /** Initalises Heston*/ |
el18jgb | 2:56b31902c800 | 26 | void init(); |
el18jgb | 20:6db651a3cfec | 27 | |
el18jgb | 20:6db651a3cfec | 28 | /** Draws the spike |
el18jgb | 20:6db651a3cfec | 29 | * @param lcd @details N5110 object |
el18jgb | 20:6db651a3cfec | 30 | */ |
el18jgb | 2:56b31902c800 | 31 | void draw(N5110 &lcd); |
el18jgb | 20:6db651a3cfec | 32 | |
el18jgb | 20:6db651a3cfec | 33 | /** update the position of the sprite in a random direction |
el18jgb | 20:6db651a3cfec | 34 | * @param pad @details Gamepad object |
el18jgb | 20:6db651a3cfec | 35 | */ |
el18jgb | 2:56b31902c800 | 36 | void update(Gamepad &pad); |
el18jgb | 20:6db651a3cfec | 37 | // accessors and mutators |
el18jgb | 20:6db651a3cfec | 38 | |
el18jgb | 20:6db651a3cfec | 39 | /** gets co-ordinates of the sprite |
el18jgb | 20:6db651a3cfec | 40 | * @ return position vector |
el18jgb | 20:6db651a3cfec | 41 | */ |
el18jgb | 5:c37f4ed2cad3 | 42 | Vector2D get_pos(); |
el18jgb | 20:6db651a3cfec | 43 | |
el18jgb | 20:6db651a3cfec | 44 | /** set co ordinates of sprite |
el18jgb | 20:6db651a3cfec | 45 | * @param int x |
el18jgb | 20:6db651a3cfec | 46 | * @param int y |
el18jgb | 20:6db651a3cfec | 47 | */ |
el18jgb | 19:33c77517cb88 | 48 | void set_pos(int x, int y); |
el18jgb | 20:6db651a3cfec | 49 | |
el18jgb | 20:6db651a3cfec | 50 | /**moves spite and turns on leds if hit occurs |
el18jgb | 20:6db651a3cfec | 51 | * @param pad @details Gamepad object |
el18jgb | 20:6db651a3cfec | 52 | * @param int x |
el18jgb | 20:6db651a3cfec | 53 | * @param int y |
el18jgb | 20:6db651a3cfec | 54 | */ |
el18jgb | 17:18ae81180853 | 55 | void hit(Gamepad &pad, int x, int y); |
el18jgb | 20:6db651a3cfec | 56 | |
el18jgb | 20:6db651a3cfec | 57 | /** on leds if miss occurs |
el18jgb | 20:6db651a3cfec | 58 | * @param pad @details Gamepad object |
el18jgb | 20:6db651a3cfec | 59 | */ |
el18jgb | 7:04a7826ff7e4 | 60 | void miss(Gamepad &pad); |
el18jgb | 20:6db651a3cfec | 61 | |
el18jgb | 20:6db651a3cfec | 62 | /** checks current score |
el18jgb | 20:6db651a3cfec | 63 | * @return Score |
el18jgb | 20:6db651a3cfec | 64 | */ |
el18jgb | 7:04a7826ff7e4 | 65 | int checkscore(); |
el18jgb | 20:6db651a3cfec | 66 | |
el18jgb | 20:6db651a3cfec | 67 | /** checks current strikes |
el18jgb | 20:6db651a3cfec | 68 | * @return strike |
el18jgb | 20:6db651a3cfec | 69 | */ |
el18jgb | 7:04a7826ff7e4 | 70 | int checkstrike(); |
el18jgb | 20:6db651a3cfec | 71 | |
el18jgb | 20:6db651a3cfec | 72 | /** increase or decrease speed that sprite is moving */ |
el18jgb | 7:04a7826ff7e4 | 73 | void set_speed(int state); |
el18jgb | 20:6db651a3cfec | 74 | |
el18jgb | 20:6db651a3cfec | 75 | /** decrease strike by 5 */ |
el18jgb | 18:c600a6545e81 | 76 | void negfive(); |
el18jgb | 2:56b31902c800 | 77 | |
el18jgb | 2:56b31902c800 | 78 | private: |
el18jgb | 2:56b31902c800 | 79 | |
el18jgb | 20:6db651a3cfec | 80 | /**vertical size sprite |
el18jgb | 20:6db651a3cfec | 81 | * @return _height |
el18jgb | 20:6db651a3cfec | 82 | */ |
el18jgb | 2:56b31902c800 | 83 | int _height; |
el18jgb | 20:6db651a3cfec | 84 | |
el18jgb | 20:6db651a3cfec | 85 | /**horizontal size sprite |
el18jgb | 20:6db651a3cfec | 86 | * @return _height |
el18jgb | 20:6db651a3cfec | 87 | */ |
el18jgb | 2:56b31902c800 | 88 | int _width; |
el18jgb | 20:6db651a3cfec | 89 | |
el18jgb | 20:6db651a3cfec | 90 | /** x position of sprite |
el18jgb | 20:6db651a3cfec | 91 | * @return _x |
el18jgb | 20:6db651a3cfec | 92 | */ |
el18jgb | 2:56b31902c800 | 93 | int _x; |
el18jgb | 20:6db651a3cfec | 94 | |
el18jgb | 20:6db651a3cfec | 95 | /** y position of sprite |
el18jgb | 20:6db651a3cfec | 96 | * @return _y |
el18jgb | 20:6db651a3cfec | 97 | */ |
el18jgb | 2:56b31902c800 | 98 | int _y; |
el18jgb | 20:6db651a3cfec | 99 | |
el18jgb | 20:6db651a3cfec | 100 | |
el18jgb | 20:6db651a3cfec | 101 | /** speed of sprite |
el18jgb | 20:6db651a3cfec | 102 | * @return _speed |
el18jgb | 20:6db651a3cfec | 103 | */ |
el18jgb | 2:56b31902c800 | 104 | int _speed; |
el18jgb | 20:6db651a3cfec | 105 | |
el18jgb | 20:6db651a3cfec | 106 | /** current score */ |
el18jgb | 7:04a7826ff7e4 | 107 | int score; |
el18jgb | 20:6db651a3cfec | 108 | |
el18jgb | 20:6db651a3cfec | 109 | /** current number of strikes left */ |
el18jgb | 7:04a7826ff7e4 | 110 | int strike; |
el18jgb | 2:56b31902c800 | 111 | |
el18jgb | 2:56b31902c800 | 112 | }; |
el18jgb | 2:56b31902c800 | 113 | #endif |