fix force arrows in turn based mode

if you got misaligned in tic_counter then you'd force arrow forever.
also, turn_based is no longer passed in! yay!
This commit is contained in:
Timothy Stiles 2020-10-14 22:07:29 +11:00
parent e53f00a432
commit bb168d7e1e
2 changed files with 2 additions and 5 deletions

View File

@ -158,7 +158,6 @@ export class Level {
this.height = stored_level.size_y; this.height = stored_level.size_y;
this.size_x = stored_level.size_x; this.size_x = stored_level.size_x;
this.size_y = stored_level.size_y; this.size_y = stored_level.size_y;
this.turn_based = false;
this.restart(compat); this.restart(compat);
} }
@ -331,8 +330,7 @@ export class Level {
} }
player_awaiting_input() { player_awaiting_input() {
//todo: the tic_counter part feels kludgey. maybe there's some other way a wait/wall nudge can wait a certain amount of time per tap? return this.player.movement_cooldown === 0 && (this.player.slide_mode === null || (this.player.slide_mode === 'force' && this.player.last_move_was_force))
return this.player.movement_cooldown === 0 && (this.player.slide_mode === null || (this.player.slide_mode === 'force' && this.player.last_move_was_force)) && this.tic_counter % 2 == 0
} }
// Move the game state forwards by one tic // Move the game state forwards by one tic
@ -573,7 +571,7 @@ export class Level {
// can override forwards??) and DEFINITELY all kinds of stuff // can override forwards??) and DEFINITELY all kinds of stuff
// in ms // in ms
if (actor === this.player && if (actor === this.player &&
(p1_primary_direction || this.turn_based) && p1_primary_direction &&
actor.last_move_was_force) actor.last_move_was_force)
{ {
if (p1_primary_direction != null) if (p1_primary_direction != null)

View File

@ -404,7 +404,6 @@ class Player extends PrimaryView {
this.turn_based_checkbox = this.root.querySelector('.controls .turn-based'); this.turn_based_checkbox = this.root.querySelector('.controls .turn-based');
this.turn_based_checkbox.addEventListener('change', ev => { this.turn_based_checkbox.addEventListener('change', ev => {
this.turn_based = !this.turn_based; this.turn_based = !this.turn_based;
this.level.turn_based = this.turn_based;
}); });
// Bind buttons // Bind buttons