ELEC2645 (2018/19) / Mbed 2 deprecated fy14lkaa

Dependencies:   mbed

Committer:
fy14lkaa
Date:
Sun May 05 13:09:34 2019 +0000
Revision:
103:cb05154d5025
Parent:
spaceship/space_ship.h@93:ab36428d0152
Child:
104:fe20457ef1a9
change file's name from space_ship.h to spaceship.h

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fy14lkaa 34:4bff5515060e 1 #ifndef SPACE_SHIP_H
fy14lkaa 34:4bff5515060e 2 #define SPACE_SHIP_H
fy14lkaa 34:4bff5515060e 3
fy14lkaa 34:4bff5515060e 4 #include "mbed.h"
fy14lkaa 34:4bff5515060e 5 #include "N5110.h"
fy14lkaa 34:4bff5515060e 6 #include "Gamepad.h"
fy14lkaa 35:261df7c3a3fb 7 #include "SpaceInvadersEngine.h"
fy14lkaa 35:261df7c3a3fb 8 #include "Alien.h"
fy14lkaa 35:261df7c3a3fb 9 #include "bullet.h"
fy14lkaa 34:4bff5515060e 10
fy14lkaa 51:cb644365d9a3 11 /** space_ship class
fy14lkaa 51:cb644365d9a3 12 @brief class for spaceship
fy14lkaa 50:f538885a788b 13 @version 1.0
fy14lkaa 50:f538885a788b 14 @author Laila Al Badwawi
fy14lkaa 50:f538885a788b 15 @date April 2019
fy14lkaa 50:f538885a788b 16 */
fy14lkaa 50:f538885a788b 17
fy14lkaa 36:9bb204e390c5 18 class space_ship
fy14lkaa 36:9bb204e390c5 19 {
fy14lkaa 51:cb644365d9a3 20
fy14lkaa 37:b2ced2de074b 21 public:
fy14lkaa 50:f538885a788b 22 // constructors
fy14lkaa 51:cb644365d9a3 23 //string Variables of this type are able to store sequences of characters,
fy14lkaa 51:cb644365d9a3 24 //such as words or sentences.
fy14lkaa 50:f538885a788b 25 /**
fy14lkaa 50:f538885a788b 26 *@constucter creat a defult a spaceship
fy14lkaa 50:f538885a788b 27 */
fy14lkaa 50:f538885a788b 28 space_ship(); //constructor
fy14lkaa 51:cb644365d9a3 29
fy14lkaa 51:cb644365d9a3 30
fy14lkaa 52:84e89553c606 31 ~space_ship(); //destructor
fy14lkaa 51:cb644365d9a3 32
fy14lkaa 51:cb644365d9a3 33
fy14lkaa 50:f538885a788b 34 /*mutators
fy14lkaa 51:cb644365d9a3 35 //mutator methods defined as methods which advice the users of the class
fy14lkaa 51:cb644365d9a3 36 //to change the value of a member variable in a controlled manner.
fy14lkaa 50:f538885a788b 37 Their names are usually pre-fixed with set_ to make this behaviour clear.*/
fy14lkaa 50:f538885a788b 38
fy14lkaa 50:f538885a788b 39
fy14lkaa 51:cb644365d9a3 40 /**
fy14lkaa 51:cb644365d9a3 41 *@brief initialise an identity for the space_ship
fy14lkaa 51:cb644365d9a3 42 *@param x @details the x-cooridante of space_shipin intger
fy14lkaa 51:cb644365d9a3 43 *@param height @details the height of space_ship in integer
fy14lkaa 51:cb644365d9a3 44 *@param width @details the widthof space_ship in integer
fy14lkaa 51:cb644365d9a3 45 */
fy14lkaa 51:cb644365d9a3 46
fy14lkaa 51:cb644365d9a3 47
fy14lkaa 50:f538885a788b 48
fy14lkaa 50:f538885a788b 49 void init(int x,int height,int width); // a mutotor method used to set the following variables (x-cooridante, height and width).
fy14lkaa 51:cb644365d9a3 50 void draw(N5110 &lcd); // a mutotor method used to set the the drawing variable to draw the space ship by using both N5110&lcd libraries.
fy14lkaa 50:f538885a788b 51 void update(Direction d,float mag); // a mutotor method used to update the direction of the spaceship and its speed(magniutde).
fy14lkaa 50:f538885a788b 52 void add_score(); // a mutotor method used to add the scores of the spaceship.everytime the buliet fires the alien so it inceased the number of scores by 1.
fy14lkaa 51:cb644365d9a3 53
fy14lkaa 50:f538885a788b 54
fy14lkaa 50:f538885a788b 55
fy14lkaa 50:f538885a788b 56
fy14lkaa 50:f538885a788b 57
fy14lkaa 50:f538885a788b 58 /*accessors
fy14lkaa 51:cb644365d9a3 59 An accessor method defined as methods which help users to read the value of a member variable.
fy14lkaa 50:f538885a788b 60 Their names are usually prefixed with get_ to make this clearer to the user.
fy14lkaa 50:f538885a788b 61 */
fy14lkaa 51:cb644365d9a3 62
fy14lkaa 51:cb644365d9a3 63
fy14lkaa 50:f538885a788b 64 int get_score(); // an accessor method used to return the number of tne scores.
fy14lkaa 50:f538885a788b 65 Vector2D get_pos(); // an accessor method used to return the position of the spaceship in vector2D.
fy14lkaa 51:cb644365d9a3 66
fy14lkaa 44:0b0d31dc3d05 67 private:
fy14lkaa 51:cb644365d9a3 68 //member variables
fy14lkaa 51:cb644365d9a3 69 //parameters
fy14lkaa 44:0b0d31dc3d05 70
fy14lkaa 51:cb644365d9a3 71 /*@param
fy14lkaa 50:f538885a788b 72 _height
fy14lkaa 50:f538885a788b 73 */
fy14lkaa 50:f538885a788b 74 int _height; // declation of a variable member _width which shows the height of the spaceship.
fy14lkaa 51:cb644365d9a3 75 /*@param
fy14lkaa 50:f538885a788b 76 _wedith
fy14lkaa 50:f538885a788b 77 */
fy14lkaa 51:cb644365d9a3 78
fy14lkaa 50:f538885a788b 79 int _width; // declation of a variable member _width which shows the width of the spaceship.
fy14lkaa 51:cb644365d9a3 80 //@param
fy14lkaa 50:f538885a788b 81 //_x
fy14lkaa 50:f538885a788b 82 int _x; //declation of a variable member _width which shows the x-cooridante of the spaceship.
fy14lkaa 51:cb644365d9a3 83 /*@param
fy14lkaa 50:f538885a788b 84 _y
fy14lkaa 50:f538885a788b 85 */
fy14lkaa 50:f538885a788b 86 int _y; //declation of a variable member _width which shows the y-cooridante of the spaceship.
fy14lkaa 51:cb644365d9a3 87 /*@param
fy14lkaa 50:f538885a788b 88 _speed
fy14lkaa 50:f538885a788b 89 */
fy14lkaa 50:f538885a788b 90 int _speed; // declation of a variable member _width which shows the speed of the spaceship.
fy14lkaa 51:cb644365d9a3 91 /*@param
fy14lkaa 51:cb644365d9a3 92 _score
fy14lkaa 50:f538885a788b 93 */
fy14lkaa 50:f538885a788b 94 int _score; // declation of a variable member _width which shows the speed of the spaceship.
fy14lkaa 50:f538885a788b 95
fy14lkaa 44:0b0d31dc3d05 96
fy14lkaa 44:0b0d31dc3d05 97 };
fy14lkaa 50:f538885a788b 98
fy14lkaa 44:0b0d31dc3d05 99 #endif
fy14lkaa 34:4bff5515060e 100
fy14lkaa 34:4bff5515060e 101
fy14lkaa 34:4bff5515060e 102
fy14lkaa 34:4bff5515060e 103
fy14lkaa 34:4bff5515060e 104
fy14lkaa 34:4bff5515060e 105
fy14lkaa 34:4bff5515060e 106
fy14lkaa 34:4bff5515060e 107
fy14lkaa 34:4bff5515060e 108
fy14lkaa 34:4bff5515060e 109
fy14lkaa 34:4bff5515060e 110
fy14lkaa 34:4bff5515060e 111
fy14lkaa 34:4bff5515060e 112
fy14lkaa 34:4bff5515060e 113
fy14lkaa 34:4bff5515060e 114
fy14lkaa 34:4bff5515060e 115
fy14lkaa 34:4bff5515060e 116
fy14lkaa 34:4bff5515060e 117
fy14lkaa 34:4bff5515060e 118
fy14lkaa 34:4bff5515060e 119
fy14lkaa 34:4bff5515060e 120
fy14lkaa 34:4bff5515060e 121
fy14lkaa 34:4bff5515060e 122
fy14lkaa 34:4bff5515060e 123
fy14lkaa 34:4bff5515060e 124
fy14lkaa 34:4bff5515060e 125
fy14lkaa 34:4bff5515060e 126
fy14lkaa 34:4bff5515060e 127
fy14lkaa 34:4bff5515060e 128
fy14lkaa 34:4bff5515060e 129