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
Diff: Bullet/Bullet.cpp
- Revision:
- 29:15e9640646b7
- Parent:
- 24:67dc71a8f009
- Child:
- 31:5c4acae51026
diff -r e0161a52a8b9 -r 15e9640646b7 Bullet/Bullet.cpp
--- a/Bullet/Bullet.cpp Wed May 08 18:02:11 2019 +0000
+++ b/Bullet/Bullet.cpp Wed May 08 21:11:35 2019 +0000
@@ -1,39 +1,47 @@
#include "Bullet.h"
-Bullet::Bullet(){
+Bullet::Bullet()
+{
}
-Bullet::~Bullet(){
+Bullet::~Bullet()
+{
}
-void Bullet::init(float dood_pos_x, float dood_pos_y){
+void Bullet::init(float dood_pos_x, float dood_pos_y)
+{
_radius = 1;
- _position_x = dood_pos_x + 12;
+ _position_x = dood_pos_x + 12;
_position_y = dood_pos_y + 4;
}
-void Bullet::draw(N5110 &lcd){
+void Bullet::draw(N5110 &lcd)
+{
lcd.drawCircle(_position_x, _position_y, _radius, FILL_BLACK);
}
-void Bullet::update(float dood_pos_x, float dood_pos_y){
+void Bullet::update(float dood_pos_x, float dood_pos_y)
+{
_position_y -= 3;
- if (_position_y < 9){ // reached end of screen
+ if (_position_y < 9) { // reached end of screen
_position_x = dood_pos_x + 12;
_position_y = dood_pos_y + 4;
}
}
-float Bullet::get_position_x(){
- float p_x = _position_x;
+float Bullet::get_position_x()
+{
+ float p_x = _position_x;
return p_x;
}
-float Bullet::get_position_y(){
+float Bullet::get_position_y()
+{
float p_y = _position_y;
return p_y;
}
-void Bullet::set_position(float pos_x, float pos_y){
- _position_x = pos_x;
+void Bullet::set_position(float pos_x, float pos_y)
+{
+ _position_x = pos_x;
_position_y = pos_y;
}