Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejfila6969 committed Feb 27, 2024
1 parent a680988 commit dd45d2d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions res/js/champs/Champ.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion res/js/champs/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class Dart {
}

draw(ctx){
ctx.fillStyle = "red";
ctx.fillStyle = "lime";
ctx.fillRect(this.x, this.y, this.width, this.height);
}
}
20 changes: 9 additions & 11 deletions res/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down

0 comments on commit dd45d2d

Please sign in to comment.