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:
- 51:4d0cd75e7ed3
- Parent:
- 50:2c5cb92a5361
- Child:
- 52:7d05e5472022
--- a/Entity/Player/Player.cpp Thu May 09 06:33:28 2019 +0000
+++ b/Entity/Player/Player.cpp Thu May 09 07:39:49 2019 +0000
@@ -4,30 +4,34 @@
// Constructor
Player::Player(float pos_x, float pos_y)
{
- moving = false;
- face = 0;
hp = 3;
attack = 1;
+ face = 2;
+
hitbox.width = 6;
hitbox.height = 5;
+
position.x = pos_x;
position.y = pos_y;
+
sprite_size.width = 6;
sprite_size.height = 12;
sprite_size.offset_x = 0;
sprite_size.offset_y = -7;
+
frame.count = 0;
frame.number = 0;
frame.max = 4;
+
for (int i = 0; i < bullets_max; i++) {
valid_bullets[i] = false;
}
- fire_rate_counter = 0;
invulnerability_counter = INVULNERABILITY_PERIOD;
// Upgradable status
fire_rate_delay = 30;
+ fire_rate_counter = fire_rate_delay;
velocity = 0.7;
_bullet_speed = 1;
}
@@ -72,8 +76,6 @@
undo_move_x(entity_to_map_collision_test(position.x, prev_pos.y, map, doorways));
undo_move_y(entity_to_map_collision_test(prev_pos.x, position.y, map, doorways));
-
- moving = false;
}
void Player::move_bullets()
@@ -88,7 +90,6 @@
void Player::increment_frames(float mapped_x, float mapped_y)
{
if (abs(mapped_x) + abs(mapped_y) > 0.1f) {
- moving = true;
if (mapped_y < 0 && abs(mapped_y) > abs(mapped_x)) {
face = 2;
} else if (mapped_y > 0 && abs(mapped_y) > abs(mapped_x)) {