diff --git a/res/js/champs/Champ.js b/res/js/champs/Champ.js index b67e641..4da0760 100644 --- a/res/js/champs/Champ.js +++ b/res/js/champs/Champ.js @@ -17,8 +17,8 @@ export class Champ { y: 10, }; this.velocity = { - x: 1, - y: 1, + x: 1.25, + y: 1.25, }; this.canShoot = true; this.dart = new EnemyDart(); diff --git a/res/js/champs/Player.js b/res/js/champs/Player.js index 33714a0..801099f 100644 --- a/res/js/champs/Player.js +++ b/res/js/champs/Player.js @@ -104,7 +104,7 @@ class Dart { } draw(ctx){ - ctx.fillStyle = "red"; + ctx.fillStyle = "lime"; ctx.fillRect(this.x, this.y, this.width, this.height); } } diff --git a/res/js/script.js b/res/js/script.js index 7d136bc..9177d21 100644 --- a/res/js/script.js +++ b/res/js/script.js @@ -72,29 +72,27 @@ const clearCanvas = () => { const update = () => { jinx.update(); - + Champ.detectHit(player.dart, jinx); + Player.detectHit(jinx.dart, player); + if(jinx.hp <= 0) { caitlyn.update(); + Champ.detectHit(player.dart, caitlyn); + Player.detectHit(caitlyn.dart, player); } if(caitlyn.hp <= 0) { ezreal.update(); + Champ.detectHit(player.dart, ezreal); + Player.detectHit(ezreal.dart, player); } if(ezreal.hp <= 0) { vayne.update(); + Champ.detectHit(player.dart, vayne); + Player.detectHit(vayne.dart, player); } player.update(keys); - - Champ.detectHit(player.dart, jinx); - Champ.detectHit(player.dart, caitlyn); - Champ.detectHit(player.dart, ezreal); - Champ.detectHit(player.dart, vayne); - - Player.detectHit(jinx.dart, player); - Player.detectHit(caitlyn.dart, player); - Player.detectHit(ezreal.dart, player); - Player.detectHit(vayne.dart, player); }; const render = () => {