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:
- 13:d04a6caba40d
- Parent:
- 11:63e54f6e7939
- Child:
- 14:3361879490b2
--- a/Entity/Bullets/Bullets.cpp Tue Apr 23 22:59:12 2019 +0000
+++ b/Entity/Bullets/Bullets.cpp Wed Apr 24 02:33:33 2019 +0000
@@ -1,15 +1,25 @@
-//#include "Bullets.h"
-//
-//Bullets::Bullets(float pos_x, float pos_y){
-// moving = false;
-// face = 0;
-// hp = 0;
-// hitbox.width = 2;
-// hitbox.height = 2;
-// position.x = pos_x;
-// position.y = pos_y;
-// sprite_size.width = 4;
-// sprite_size.height = 2;
-// sprite_size.offset_x = 2;
-// sprite_size.offset_y = 0;
-//}
\ No newline at end of file
+#include "Bullets.h"
+
+Bullets::Bullets(float pos_x, float pos_y, int dir){
+ moving = true;
+ face = 0;
+ hp = 1;
+ hitbox.width = 2;
+ hitbox.height = 2;
+ position.x = pos_x;
+ position.y = pos_y;
+ sprite_size.width = 2;
+ sprite_size.height = 2;
+ sprite_size.offset_x = 0;
+ sprite_size.offset_y = 0;
+ direction = dir;
+}
+
+void Bullets::move(float speed, float unused){
+ position.x += (direction < 2)*speed;
+ position.y += (direction < 2)*speed;
+}
+
+int * Bullets::get_frame(){
+ return (int *) bullets_sprite;
+}
\ No newline at end of file