Steven Mahasin / Mbed 2 deprecated DreamDungeon

Dependencies:   mbed MotionSensor

Revision:
13:d04a6caba40d
Parent:
12:a1c1991835ca
Child:
14:3361879490b2
--- a/Entity/Player/Player.cpp	Tue Apr 23 22:59:12 2019 +0000
+++ b/Entity/Player/Player.cpp	Wed Apr 24 02:33:33 2019 +0000
@@ -1,10 +1,11 @@
 #include "Player.h"
 #include "math.h"
 
+// Constructor
 Player::Player(float pos_x, float pos_y){
     moving = false;
     face = 0;
-    hp = 0;
+    hp = 1;
     hitbox.width = 6;
     hitbox.height = 5;
     position.x = pos_x;
@@ -16,8 +17,13 @@
     frame.count = 0;
     frame.number = 0;
     frame.max = 4;
+    for (int i = 0; i < bullets_max; i++){valid_bullets[i] = false;}
 }
 
+// Accessors
+int get_attack(){return 1;};
+
+// Functions
 void Player::move(float mapped_x, float mapped_y){
     if(!matrix_collision_test(position.x + player_speed*mapped_x, position.y, 0)){
         position.x += player_speed*mapped_x;
@@ -58,14 +64,9 @@
     return (int *) sprite_player[face][frame.number];
 }
 
-void Player::chkdmg(){
-    
-}
-
 void Player::buttons(bool button_A, bool button_B, bool button_Y, bool button_X){
     if (button_Y){
         face = 0;
-            
     }
     else if (button_B){
         face = 1;
@@ -76,4 +77,11 @@
     else if (button_X){
         face = 3;
     }
+    for (int i = 0; i < bullets_max; i++){
+        if (!valid_bullets[i]){
+            bullets_array[i] = new Bullets(position.x, position.y, face);
+            valid_bullets[i] = true;
+            break;
+        }
+    }
 }