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:
- 18:9f40a2f8c2c5
- Parent:
- 17:74de8c17ddac
- Child:
- 19:5a7b0cdf013b
--- a/Bullet/Bullet.cpp Wed Apr 24 10:37:47 2019 +0000
+++ b/Bullet/Bullet.cpp Wed Apr 24 12:43:52 2019 +0000
@@ -14,15 +14,12 @@
lcd.drawCircle(_position_x, _position_y, _radius, FILL_BLACK);
}
-void Bullet::update(float dood_position_x, float dood_position_y, bool button_Y){
- _position_x = get_position_x();
- _position_y = get_position_y();
- if (button_Y == true){
- _position_y -= 2; // moves upwards
- }
- if (_position_y < 0){ // checking it leaves screen
- _position_x =dood_position_x;
- _position_y =dood_position_y;
+void Bullet::update(float position_x, float position_y, float dood_pos_x, float dood_pos_y){
+ _position_x = position_x;
+ _position_y -= 2;
+ if (_position_y < 0){ // reached end of screen
+ _position_x = dood_pos_x;
+ _position_y = dood_pos_y;
}
}