Add skill system, level-ups, and new enemy types
This commit is contained in:
+10
-3
@@ -98,6 +98,9 @@ export class Sword extends Weapon {
|
||||
|
||||
const { game } = player;
|
||||
|
||||
const range = player.stats.swordRange;
|
||||
const damage = player.stats.swordDamage;
|
||||
|
||||
// Aim direction: where the blob actually faces (toward the mouse point)
|
||||
const aim = new THREE.Vector3()
|
||||
.subVectors(game.groundPoint, player.body.position);
|
||||
@@ -109,15 +112,19 @@ export class Sword extends Weapon {
|
||||
aim.normalize();
|
||||
|
||||
// Slash trail feedback
|
||||
const slash = new SlashEffect(player.body.position, aim, game.scene);
|
||||
const slash = new SlashEffect(player.body.position, aim, game.scene, range);
|
||||
game.slashEffects.push(slash);
|
||||
|
||||
for (const enemy of game.enemies) {
|
||||
if (enemy.dead) continue;
|
||||
if (isInSlashArc(player.body.position, aim, enemy.body.position)) {
|
||||
enemy.takeDamage(50, game);
|
||||
if (!enemy.canBeSlashHit()) continue;
|
||||
if (isInSlashArc(player.body.position, aim, enemy.body.position, range)) {
|
||||
enemy.takeDamage(damage, game, true, player.body.position);
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy enemy projectiles caught in the slash
|
||||
game.destroyProjectilesInArc(player.body.position, aim, range);
|
||||
}
|
||||
|
||||
skill2(): void {
|
||||
|
||||
Reference in New Issue
Block a user