Skip to content

Commit

Permalink
Use LARGE_INT instead of Number.MAX_SAFE_INTEGER
Browse files Browse the repository at this point in the history
  • Loading branch information
remvst committed Sep 1, 2023
1 parent b20ec0f commit 117871d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ const CONSTANTS = {
"const": "let",
"null": 0,

"LARGE_INT": 9999,

"CANVAS_WIDTH": 1280,
"CANVAS_HEIGHT": 720,

Expand Down
2 changes: 1 addition & 1 deletion src/js/entities/characters/dummy-enemy.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class DummyEnemy extends Enemy {
super();
this.categories.push('enemy');

this.health = this.maxHealth = Number.MAX_SAFE_INTEGER;
this.health = LARGE_INT;
}

renderBody() {
Expand Down
4 changes: 2 additions & 2 deletions src/js/level/intro-level.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class IntroLevel extends Level {
camera.cycle(99);

const player = firstItem(scene.category('player'));
player.health = Number.MAX_SAFE_INTEGER;
player.health = LARGE_INT;
player.setController(new CharacterController());

// Respawn when leaving the area
Expand Down Expand Up @@ -105,7 +105,7 @@ class IntroLevel extends Level {
// Shield tutorial
const SwordArmorEnemy = createEnemyType({ sword: true, armor: true, attackCount: 1, });
const enemy = scene.add(new SwordArmorEnemy());
enemy.health = enemy.maxHealth = Number.MAX_SAFE_INTEGER;
enemy.health = LARGE_INT;
enemy.x = camera.x + CANVAS_WIDTH / 2 / camera.zoom + 20;
enemy.y = -99;
scene.add(new CharacterOffscreenIndicator(enemy));
Expand Down

0 comments on commit 117871d

Please sign in to comment.