Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
BulletS/BulletS.cpp
- Committer:
- josh_ohara
- Date:
- 2020-03-14
- Revision:
- 3:8a140aa1ddcd
- Parent:
- 2:c2316b659b97
- Child:
- 4:18a1fc4c38e0
File content as of revision 3:8a140aa1ddcd:
#include "BulletS.h"
#include "Ship.cpp"
Bullet::Bullet()
{
}
void Bullet::init(int size, int speed)
{ int ShipHeight = get_height();
Size = size;
Speed = speed;
X = WIDTH/2 - Size/2; //Middle of the ship
Y = HEIGHT - ShipHeight; //Top of the ship
}
void Bullet::draw(N5110 &lcd)
{
lcd.drawRect(X,Y,Size,Size,FILL_BLACK);
}
void update();
if(pad.A_pressed()) {
Speed = 1; //shoots bullet if pad a pressed
Y -= Speed;
}
Vector2D Ship::get_position();
Vector2D p = {X,Y};
return p;
}