ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jkeo

Dependencies:   mbed

Committer:
josh_ohara
Date:
Sat May 16 16:18:32 2020 +0000
Revision:
27:eb755a345b1f
Parent:
18:828e9f6ddfdb
Child:
29:1615c1cffa6f
Code tidy

Who changed what in which revision?

UserRevisionLine numberNew contents of line
josh_ohara 16:987f72d9bb8f 1
josh_ohara 16:987f72d9bb8f 2 #include "mbed.h"
josh_ohara 16:987f72d9bb8f 3 #include "N5110.h"
josh_ohara 16:987f72d9bb8f 4 #include "Gamepad.h"
josh_ohara 16:987f72d9bb8f 5
josh_ohara 16:987f72d9bb8f 6 class AlienBullet
josh_ohara 16:987f72d9bb8f 7 {
josh_ohara 16:987f72d9bb8f 8 public:
josh_ohara 27:eb755a345b1f 9 AlienBullet();
josh_ohara 16:987f72d9bb8f 10 ~AlienBullet();
josh_ohara 27:eb755a345b1f 11 void init(int x, int y); //initialises objects and sets private variables
josh_ohara 27:eb755a345b1f 12 void render(N5110 &lcd); //draws bullet
josh_ohara 27:eb755a345b1f 13 void update(); //udpdates private variables
josh_ohara 27:eb755a345b1f 14 //accessors and mutators
josh_ohara 27:eb755a345b1f 15 Vector2D get_position(); //returns the x and y position of the bullet
josh_ohara 27:eb755a345b1f 16 void set_hit(bool x); //sets the hit value of the bullet
josh_ohara 27:eb755a345b1f 17 bool get_hit(); //returns the hit value of the bullet
josh_ohara 16:987f72d9bb8f 18
josh_ohara 16:987f72d9bb8f 19 private:
josh_ohara 27:eb755a345b1f 20 int _y; //y position of the bullet
josh_ohara 27:eb755a345b1f 21 int _x; //x position of the bullet
josh_ohara 27:eb755a345b1f 22 int _speed; //speed of the bullet (y direction)
josh_ohara 27:eb755a345b1f 23 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 24
josh_ohara 16:987f72d9bb8f 25 };
josh_ohara 16:987f72d9bb8f 26
josh_ohara 16:987f72d9bb8f 27