fix cast times

This commit is contained in:
2025-01-12 14:50:37 +09:00
parent d9d62d7070
commit 302d2f0618
3 changed files with 46 additions and 26 deletions
+6 -6
View File
@@ -34,7 +34,7 @@ app.ws('/ws', async (req, res) => {
console.log(message)
if (message.action == 'teleport') {
entity.teleport(message.x, message.y)
entity.teleport(new Vector2(message.x, message.y))
}
if (message.action == 'move') {
@@ -50,7 +50,7 @@ app.ws('/ws', async (req, res) => {
function testScenario() {
const entity1 = new Entity()
entity1.id = '1'
entity1.teleport(200, 500)
entity1.teleport(new Vector2(200, 500))
entity1.radius = 50
entity1.maxHealth = 100
entity1.health = 80
@@ -58,7 +58,7 @@ function testScenario() {
const entity2 = new Entity()
entity2.id = '2'
entity2.teleport(110, 110)
entity2.teleport(new Vector2(110, 110))
entity2.radius = 50
entity2.maxHealth = 50
entity2.health = 50
@@ -123,7 +123,7 @@ function testScenario() {
function laneScenario() {
const entity1 = new Entity()
entity1.id = '1'
entity1.teleport(200, 200)
entity1.teleport(new Vector2(200, 200))
entity1.radius = 50
entity1.maxHealth = 100
entity1.health = 100
@@ -131,7 +131,7 @@ function laneScenario() {
const entity2 = new Entity()
entity2.id = '2'
entity2.teleport(1800, 1800)
entity2.teleport(new Vector2(1800, 1800))
entity2.radius = 50
entity2.maxHealth = 100
entity2.health = 100
@@ -167,7 +167,7 @@ app.listen(port, () => {
console.log(`Server started! Visit http://localhost:${port}`)
laneScenario()
game.entities[0].castAction(1, 2000, 2000)
game.entities[0].castAction(3, 2000, 2000)
game.start()
})