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 MotionSensor
Diff: Entity/Bullets/Bullets.cpp
- Revision:
- 14:3361879490b2
- Parent:
- 13:d04a6caba40d
- Child:
- 15:44d5cc33d389
diff -r d04a6caba40d -r 3361879490b2 Entity/Bullets/Bullets.cpp
--- a/Entity/Bullets/Bullets.cpp Wed Apr 24 02:33:33 2019 +0000
+++ b/Entity/Bullets/Bullets.cpp Wed Apr 24 03:09:00 2019 +0000
@@ -16,10 +16,30 @@
}
void Bullets::move(float speed, float unused){
- position.x += (direction < 2)*speed;
- position.y += (direction < 2)*speed;
+ if (direction == 0){
+ position.y -= speed;
+ }
+ else if (direction == 1){
+ position.x += speed;
+ }
+ else if (direction == 2){
+ position.y += speed;
+ }
+ else if (direction == 3){
+ position.x -= speed;
+ }
}
int * Bullets::get_frame(){
return (int *) bullets_sprite;
+}
+
+bool Bullets::out_of_bounds_check(){
+ if (matrix_collision_test(position.x, position.y, 0)){
+ return true;
+ }
+ else if ((!(0 < position.x < 84)) || (!(0 < position.y < 48))){
+ return true;
+ }
+ return false;
}
\ No newline at end of file