FINAL VERSION

Dependencies:   mbed

Committer:
jamesheavey
Date:
Thu May 09 14:36:51 2019 +0000
Revision:
140:d8634e76ecce
Parent:
135:888ae932cd70
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jamesheavey 28:d058f7f5885d 1 #ifndef LASER_H
jamesheavey 28:d058f7f5885d 2 #define LASER_H
jamesheavey 28:d058f7f5885d 3
jamesheavey 28:d058f7f5885d 4 #include "mbed.h"
jamesheavey 28:d058f7f5885d 5 #include "N5110.h"
jamesheavey 28:d058f7f5885d 6 #include "Gamepad.h"
jamesheavey 28:d058f7f5885d 7 #include "Paddle.h"
jamesheavey 28:d058f7f5885d 8
jamesheavey 129:b47c28c7eaaf 9 /** Laser Class
jamesheavey 86:01f33d94e496 10 @author James Heavey, University of Leeds
jamesheavey 91:c01a736fb0d9 11 @brief Controls the Laser in the Breakout game
jamesheavey 86:01f33d94e496 12 @date May 2019
jamesheavey 91:c01a736fb0d9 13 */
jamesheavey 28:d058f7f5885d 14 class Laser
jamesheavey 28:d058f7f5885d 15 {
jamesheavey 28:d058f7f5885d 16
jamesheavey 28:d058f7f5885d 17 public:
jamesheavey 129:b47c28c7eaaf 18
jamesheavey 129:b47c28c7eaaf 19 /** Constructor declaration */
jamesheavey 28:d058f7f5885d 20 Laser();
jamesheavey 129:b47c28c7eaaf 21
jamesheavey 129:b47c28c7eaaf 22 /** Deconstructor declaration */
jamesheavey 28:d058f7f5885d 23 ~Laser();
jamesheavey 129:b47c28c7eaaf 24
jamesheavey 129:b47c28c7eaaf 25 /** Initialises the laser off screen with a set velocity */
jamesheavey 93:18f81996ea89 26 void init();
jamesheavey 129:b47c28c7eaaf 27
jamesheavey 129:b47c28c7eaaf 28 /** Draws the Laser at at its current coordinates on the LCD
jamesheavey 130:46f3fac2bdf9 29 * @param lcd @details a N5110 pointer
jamesheavey 129:b47c28c7eaaf 30 */
jamesheavey 28:d058f7f5885d 31 void draw(N5110 &lcd);
jamesheavey 129:b47c28c7eaaf 32
jamesheavey 129:b47c28c7eaaf 33 /** Update the Laser's y coordinate based on its velocity */
jamesheavey 28:d058f7f5885d 34 void update();
jamesheavey 129:b47c28c7eaaf 35
jamesheavey 129:b47c28c7eaaf 36 /** Sets the Laser's x coordinate
jamesheavey 131:c227bbfb38b0 37 * @param x @details set the variable _x to the new local x
jamesheavey 129:b47c28c7eaaf 38 */
jamesheavey 129:b47c28c7eaaf 39 void set_posx(int x);
jamesheavey 129:b47c28c7eaaf 40
jamesheavey 129:b47c28c7eaaf 41 /** Sets the Laser's x coordinate
jamesheavey 131:c227bbfb38b0 42 * @param y @details set the variable _y to the new local y
jamesheavey 129:b47c28c7eaaf 43 */
jamesheavey 129:b47c28c7eaaf 44 void set_posy(int y);
jamesheavey 129:b47c28c7eaaf 45
jamesheavey 129:b47c28c7eaaf 46 /** Retrieve the Laser's current x coordinate
jamesheavey 135:888ae932cd70 47 * @returns variable _x as an integer
jamesheavey 129:b47c28c7eaaf 48 */
jamesheavey 36:cb73014d3a99 49 int get_x();
jamesheavey 129:b47c28c7eaaf 50
jamesheavey 129:b47c28c7eaaf 51 /** Retrieve the Laser's current y coordinate
jamesheavey 135:888ae932cd70 52 * @returns variable _y as an integer
jamesheavey 129:b47c28c7eaaf 53 */
jamesheavey 36:cb73014d3a99 54 int get_y();
jamesheavey 91:c01a736fb0d9 55
jamesheavey 28:d058f7f5885d 56 private:
jamesheavey 28:d058f7f5885d 57
jamesheavey 93:18f81996ea89 58 int _speed_y;
jamesheavey 28:d058f7f5885d 59 int _x;
jamesheavey 28:d058f7f5885d 60 int _y;
jamesheavey 129:b47c28c7eaaf 61
jamesheavey 28:d058f7f5885d 62 };
jamesheavey 28:d058f7f5885d 63 #endif