ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jkeo

Dependencies:   mbed

Committer:
josh_ohara
Date:
Sun May 17 15:09:49 2020 +0000
Revision:
29:1615c1cffa6f
Parent:
27:eb755a345b1f
Child:
30:4504b5dd47d1
COde tidy; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
josh_ohara 16:987f72d9bb8f 1 #include "mbed.h"
josh_ohara 16:987f72d9bb8f 2 #include "N5110.h"
josh_ohara 16:987f72d9bb8f 3 #include "Gamepad.h"
josh_ohara 16:987f72d9bb8f 4
josh_ohara 16:987f72d9bb8f 5 class AlienBullet
josh_ohara 16:987f72d9bb8f 6 {
josh_ohara 16:987f72d9bb8f 7 public:
josh_ohara 27:eb755a345b1f 8 AlienBullet();
josh_ohara 16:987f72d9bb8f 9 ~AlienBullet();
josh_ohara 27:eb755a345b1f 10 void init(int x, int y); //initialises objects and sets private variables
josh_ohara 27:eb755a345b1f 11 void render(N5110 &lcd); //draws bullet
josh_ohara 27:eb755a345b1f 12 void update(); //udpdates private variables
josh_ohara 27:eb755a345b1f 13 //accessors and mutators
josh_ohara 27:eb755a345b1f 14 Vector2D get_position(); //returns the x and y position of the bullet
josh_ohara 27:eb755a345b1f 15 void set_hit(bool x); //sets the hit value of the bullet
josh_ohara 27:eb755a345b1f 16 bool get_hit(); //returns the hit value of the bullet
josh_ohara 16:987f72d9bb8f 17
josh_ohara 16:987f72d9bb8f 18 private:
josh_ohara 27:eb755a345b1f 19 int _y; //y position of the bullet
josh_ohara 27:eb755a345b1f 20 int _x; //x position of the bullet
josh_ohara 27:eb755a345b1f 21 int _speed; //speed of the bullet (y direction)
josh_ohara 27:eb755a345b1f 22 bool _hit; //variable to show if bullet has caused a hit, functions the same as the life variable of the ship but logically opposite
josh_ohara 16:987f72d9bb8f 23
josh_ohara 16:987f72d9bb8f 24 };
josh_ohara 16:987f72d9bb8f 25
josh_ohara 16:987f72d9bb8f 26