Commit 4c8f7eac by Alexander Bazo

Update player damage to use time based measures instead of frame based

parent b6c9428a
...@@ -35,8 +35,8 @@ class GameConfiguration { ...@@ -35,8 +35,8 @@ class GameConfiguration {
gazePointRadius = 15; gazePointRadius = 15;
gazePointColor = "#4cd494"; gazePointColor = "#4cd494";
maxNumberOfEnemies = 10; maxNumberOfEnemies = 10;
enemySpawnDelay = 1000; enemySpawnDelay = 500;
playerDamage = 15; playerDamage = 50;
worldBackgroundColor = "#333"; worldBackgroundColor = "#333";
debugInfoPosition = { debugInfoPosition = {
x: 10, x: 10,
......
...@@ -46,7 +46,7 @@ function updateEnemies(now, delta) { ...@@ -46,7 +46,7 @@ function updateEnemies(now, delta) {
if ((now - lastEnemySpawn) >= GameConfig.getEnemySpawnDelay()) { if ((now - lastEnemySpawn) >= GameConfig.getEnemySpawnDelay()) {
if (enemies.length < GameConfig.getMaxNumberOfEnemies()) { if (enemies.length < GameConfig.getMaxNumberOfEnemies()) {
Logger.log("Add new enemy", "Game"); Logger.log("Add new enemy", "Game");
enemies.push(Enemy.createEnemy(GameConfig.getScreenWidth(), -50, planet.x, planet.y)); enemies.push(Enemy.createEnemy(GameConfig.getScreenWidth(), 100, planet.x, planet.y));
lastEnemySpawn = now; lastEnemySpawn = now;
} }
} }
...@@ -77,7 +77,7 @@ function updateEnemies(now, delta) { ...@@ -77,7 +77,7 @@ function updateEnemies(now, delta) {
y: currentGazePosition.targetY, y: currentGazePosition.targetY,
})) { })) {
// Update enemy's health // Update enemy's health
enemies[i].health -= GameConfig.getPlayerDamage(); enemies[i].health -= GameConfig.getPlayerDamage() / (1000/delta);
// Remove enemy if destroyed // Remove enemy if destroyed
if (enemies[i].health <= 0) { if (enemies[i].health <= 0) {
Logger.log(`Enemy destroyed by player`, "Game"); Logger.log(`Enemy destroyed by player`, "Game");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment