Added ceiling to jump calculations, increased the features available when displaying devtools and fixed the toggle glitch

This commit is contained in:
rain
2023-11-16 21:36:27 -06:00
parent 1eef69f514
commit 8013ba262a
6 changed files with 114 additions and 14 deletions
+7 -3
View File
@@ -8,6 +8,7 @@ export class UI {
this.padding = 5;
this.x = this.game.width;
this.y = 0;
this.devtools = false; // Used to toggle state on hitboxes
}
draw(ctx, entity) {
@@ -32,14 +33,17 @@ export class UI {
this.game = game;
this.hearts = this.game.map.player.hearts;
// TODO: Adjust this later so players can long press 'b' with the same effects
let keys = this.game.input.keys;
if(keys.includes('b')) {
if(this.game.hitboxes) {
if(this.game.hitboxes && !this.devtools) {
this.game.hitboxes = false;
} else {
this.devtools = true;
} else if(!this.game.hitboxes && !this.devtools) {
this.game.hitboxes = true;
this.devtools = true;
}
} else {
this.devtools = false;
}
}
}