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 {
gazePointRadius = 15;
gazePointColor = "#4cd494";
maxNumberOfEnemies = 10;
enemySpawnDelay = 1000;
playerDamage = 15;
enemySpawnDelay = 500;
playerDamage = 50;
worldBackgroundColor = "#333";
debugInfoPosition = {
x: 10,
......
......@@ -46,7 +46,7 @@ function updateEnemies(now, delta) {
if ((now - lastEnemySpawn) >= GameConfig.getEnemySpawnDelay()) {
if (enemies.length < GameConfig.getMaxNumberOfEnemies()) {
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;
}
}
......@@ -77,7 +77,7 @@ function updateEnemies(now, delta) {
y: currentGazePosition.targetY,
})) {
// Update enemy's health
enemies[i].health -= GameConfig.getPlayerDamage();
enemies[i].health -= GameConfig.getPlayerDamage() / (1000/delta);
// Remove enemy if destroyed
if (enemies[i].health <= 0) {
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