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/Player/Player.cpp
- Revision:
- 16:ddb203a74dfc
- Parent:
- 15:44d5cc33d389
- Child:
- 21:be18f33da757
- Child:
- 22:7abf4581bc9b
diff -r 44d5cc33d389 -r ddb203a74dfc Entity/Player/Player.cpp
--- a/Entity/Player/Player.cpp Wed Apr 24 06:28:14 2019 +0000
+++ b/Entity/Player/Player.cpp Wed Apr 24 21:21:37 2019 +0000
@@ -5,7 +5,7 @@
Player::Player(float pos_x, float pos_y){
moving = false;
face = 0;
- hp = 1;
+ hp = 3;
hitbox.width = 6;
hitbox.height = 5;
position.x = pos_x;
@@ -19,7 +19,10 @@
frame.max = 4;
for (int i = 0; i < bullets_max; i++){valid_bullets[i] = false;}
fire_rate_counter = 0;
- fire_rate_delay = 5;
+
+ // Upgradable status
+ fire_rate_delay = 12;
+ velocity = 1.4;
}
// Accessors
@@ -27,11 +30,11 @@
// 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;
+ if(!matrix_collision_test(position.x + velocity*mapped_x, position.y, 0)){
+ position.x += velocity*mapped_x;
}
- if(!matrix_collision_test(position.x, position.y - player_speed*mapped_y, 0)){
- position.y -= player_speed*mapped_y;
+ if(!matrix_collision_test(position.x, position.y - velocity*mapped_y, 0)){
+ position.y -= velocity*mapped_y;
}
moving = false;
if (abs(mapped_x) + abs(mapped_y) > 0.1f){