
Joshua O'hara 201291390
Dependencies: mbed
Diff: AlienBullet/AlienBullet.cpp
- Revision:
- 16:987f72d9bb8f
- Child:
- 18:828e9f6ddfdb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AlienBullet/AlienBullet.cpp Fri May 01 12:56:33 2020 +0000 @@ -0,0 +1,42 @@ +#include "AlienBullet.h" + +AlienBullet::AlienBullet() +{ +} +AlienBullet::~AlienBullet() +{ +} + +void AlienBullet::init(int x, int y) { + Speed = 1; + Hit = false; + X = x; //x=Middle of the ship + Y = y; + //y=Top of the ship Height is ship Height +} + +void AlienBullet::render(N5110 &lcd) +{ + if(Hit == false) { + lcd.setPixel(X,Y,true); + } +} + +void AlienBullet::update(Gamepad &pad,N5110 &lcd) { + Y+= Speed; +} + +Vector2D AlienBullet::get_position() { + Vector2D p = {X,Y}; + return p; +} + +void AlienBullet::set_hit(bool x) { + Hit = x; +} + +bool AlienBullet::get_hit() { + bool x = Hit; + return x; +} +