Minor bug fixes to bandit hideout adventure.
This commit is contained in:
@@ -47,10 +47,12 @@ int hideoutBaseX = BANDIT_HIDEOUT_MAP_SIZE - 1;
|
||||
int hideoutBarricadeHealth = 0;
|
||||
int hideoutBarricadeMax = 0;
|
||||
int hideoutBanditsKilled = 0;
|
||||
bool hideoutPlayerJumping = false;
|
||||
timer hideoutWalkTimer;
|
||||
timer hideoutAttackTimer;
|
||||
timer hideoutSearchTimer;
|
||||
timer hideoutSearchDelayTimer;
|
||||
timer hideoutJumpTimer;
|
||||
bool hideoutSearching = false;
|
||||
|
||||
string pick_hideout_terrain() {
|
||||
@@ -202,6 +204,7 @@ void init_bandit_hideout_adventure() {
|
||||
hideoutPlayerFacing = 1;
|
||||
hideoutBaseX = BANDIT_HIDEOUT_MAP_SIZE - 1;
|
||||
hideoutBanditsKilled = 0;
|
||||
hideoutPlayerJumping = false;
|
||||
|
||||
int barricadeBase = current_day * BANDIT_HIDEOUT_BARRICADE_HP_PER_DAY;
|
||||
if (barricadeBase < BANDIT_HIDEOUT_BARRICADE_HP_PER_DAY) barricadeBase = BANDIT_HIDEOUT_BARRICADE_HP_PER_DAY;
|
||||
@@ -265,6 +268,7 @@ void run_bandit_hideout_adventure() {
|
||||
|
||||
handle_hideout_player_movement();
|
||||
handle_hideout_player_actions();
|
||||
update_hideout_player_jump();
|
||||
update_hideout_search();
|
||||
|
||||
update_hideout_bandits();
|
||||
@@ -299,19 +303,26 @@ void handle_hideout_player_movement() {
|
||||
hideoutWalkTimer.restart();
|
||||
}
|
||||
|
||||
if (hideoutWalkTimer.elapsed > walk_speed) {
|
||||
int moveTime = hideoutPlayerJumping ? jump_speed : walk_speed;
|
||||
if (hideoutWalkTimer.elapsed > moveTime) {
|
||||
if (key_down(KEY_LEFT) && hideoutPlayerX > 0) {
|
||||
hideoutPlayerFacing = 0;
|
||||
hideoutPlayerX--;
|
||||
hideoutWalkTimer.restart();
|
||||
if (player_health > 0) play_hideout_player_footstep();
|
||||
if (player_health > 0 && !hideoutPlayerJumping) play_hideout_player_footstep();
|
||||
} else if (key_down(KEY_RIGHT) && hideoutPlayerX < hideoutBaseX) {
|
||||
hideoutPlayerFacing = 1;
|
||||
hideoutPlayerX++;
|
||||
hideoutWalkTimer.restart();
|
||||
if (player_health > 0) play_hideout_player_footstep();
|
||||
if (player_health > 0 && !hideoutPlayerJumping) play_hideout_player_footstep();
|
||||
}
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_UP) && !hideoutPlayerJumping) {
|
||||
hideoutPlayerJumping = true;
|
||||
hideoutJumpTimer.restart();
|
||||
p.play_stationary("sounds/jump.ogg", false);
|
||||
}
|
||||
}
|
||||
|
||||
void handle_hideout_player_actions() {
|
||||
@@ -530,6 +541,13 @@ bool damage_hideout_bandit_at(int pos, int damage) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void update_hideout_player_jump() {
|
||||
if (hideoutPlayerJumping && hideoutJumpTimer.elapsed > 850) {
|
||||
hideoutPlayerJumping = false;
|
||||
if (player_health > 0) play_hideout_player_footstep();
|
||||
}
|
||||
}
|
||||
|
||||
bool try_hideout_bandit_attack_player(HideoutBandit@ bandit) {
|
||||
if (player_health <= 0) return false;
|
||||
if (abs(bandit.position - hideoutPlayerX) > 1) return false;
|
||||
|
||||
Reference in New Issue
Block a user