fix auto-attack targeting

This commit is contained in:
2025-01-13 11:45:26 +09:00
parent 49a4d3e924
commit 03bbea4862
8 changed files with 32 additions and 134 deletions
+3 -78
View File
@@ -35,11 +35,6 @@ app.ws('/ws', async (req, res) => {
}
console.log(message)
// DEPRECATED: teleporting is now directly possible via Ability...
if (message.action == 'teleport') {
entity.teleport(new Vector2(message.x, message.y))
}
if (message.action == 'attack') {
entity.attackAction(message.x, message.y)
}
@@ -62,79 +57,6 @@ app.ws('/ws', async (req, res) => {
})
})
// function testScenario() {
// const entity1 = new Entity()
// entity1.id = '1'
// entity1.teleport(new Vector2(200, 500))
// entity1.radius = 50
// entity1.maxHealth = 100
// entity1.health = 80
// game.spawnEntity(entity1)
// const entity2 = new Entity()
// entity2.id = '2'
// entity2.teleport(new Vector2(110, 110))
// entity2.radius = 50
// entity2.maxHealth = 50
// entity2.health = 50
// game.spawnEntity(entity2)
// const horseshoe = new Terrain([
// { x: 400, y: 200 },
// { x: 600, y: 200 },
// { x: 700, y: 300 },
// { x: 650, y: 600 },
// { x: 400, y: 600 },
// { x: 400, y: 450 },
// { x: 600, y: 500 },
// { x: 600, y: 300 },
// { x: 400, y: 300 },
// ])
// horseshoe.id = 'horseshoe'
// game.addTerrain(horseshoe)
// const stopsign = new Terrain([
// { x: 800, y: 800 },
// { x: 900, y: 900 },
// { x: 900, y: 1000 },
// { x: 800, y: 1100 },
// { x: 800, y: 1100 },
// { x: 700, y: 1100 },
// { x: 600, y: 1000 },
// { x: 600, y: 900 },
// { x: 700, y: 800 },
// ])
// stopsign.id = 'stopsign'
// game.addTerrain(stopsign)
// const box = new Terrain([
// { x: 1200, y: 700 },
// { x: 1200, y: 800 },
// { x: 1300, y: 800 },
// { x: 1300, y: 700 },
// ])
// box.id = 'box'
// game.addTerrain(box)
// const diamond = new Terrain([
// { x: 1000, y: 300 },
// { x: 1100, y: 400 },
// { x: 1000, y: 500 },
// { x: 900, y: 400 },
// ])
// diamond.id = 'diamond'
// game.addTerrain(diamond)
// const pole = new Terrain([
// { x: 400, y: 1000 },
// { x: 410, y: 1000 },
// { x: 410, y: 1010 },
// { x: 400, y: 1010 },
// ])
// pole.id = 'pole'
// game.addTerrain(pole)
// }
function laneScenario() {
const entity1 = new Entity({
id: '1',
@@ -197,6 +119,9 @@ function laneScenario() {
if (entity.id == '2') {
entity.teleport(new Vector2(1600, 1800))
}
if (entity.id == '3') {
entity.teleport(new Vector2(1800, 1600))
}
}
}
}