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:
- 21:be18f33da757
- Parent:
- 15:44d5cc33d389
- Child:
- 23:5a8f75e93508
diff -r bfe410c82b45 -r be18f33da757 Entity/Bullets/Bullets.cpp
--- a/Entity/Bullets/Bullets.cpp Thu Apr 25 03:56:09 2019 +0000
+++ b/Entity/Bullets/Bullets.cpp Thu Apr 25 05:27:43 2019 +0000
@@ -1,6 +1,7 @@
#include "Bullets.h"
-Bullets::Bullets(float pos_x, float pos_y, int dir){
+Bullets::Bullets(float pos_x, float pos_y, int dir)
+{
moving = true;
face = 0;
hp = 1;
@@ -15,30 +16,30 @@
direction = dir;
}
-void Bullets::move(float speed, float unused){
- if (direction == 0){
+void Bullets::move(float speed, float unused)
+{
+ if (direction == 0) {
position.y -= speed;
- }
- else if (direction == 1){
+ } else if (direction == 1) {
position.x += speed;
- }
- else if (direction == 2){
+ } else if (direction == 2) {
position.y += speed;
- }
- else if (direction == 3){
+ } else if (direction == 3) {
position.x -= speed;
}
}
-int * Bullets::get_frame(){
+int * Bullets::get_frame()
+{
return (int *) bullets_sprite;
}
-bool Bullets::out_of_bounds_check(){
- if (matrix_collision_test(position.x, position.y, 0)){
+bool Bullets::out_of_bounds_check()
+{
+ if (matrix_collision_test(position.x, position.y, 0)) {
return true;
}
- if ((0 > position.x) || (position.x > 84) || (0 > position.y) || (position.y > 48)){
+ if ((0 > position.x) || (position.x > 84) || (0 > position.y) || (position.y > 48)) {
return true;
}
return false;