fix invalid id reported on entities query
This commit is contained in:
+4
-2
@@ -1,4 +1,4 @@
|
||||
import { Dungeon } from './level.js'
|
||||
import * as LEVEL from './level.js'
|
||||
import { WebSocketExpress } from 'websocket-express'
|
||||
import express from 'express'
|
||||
import Game from './game.js'
|
||||
@@ -35,6 +35,7 @@ app.ws('/ws', async (req, res) => {
|
||||
console.info(message)
|
||||
if (message.action == 'entities') {
|
||||
websocket.send(JSON.stringify({ entities: game.entities.map((it) => it.id) }))
|
||||
return
|
||||
}
|
||||
|
||||
if (message.action == 'join') {
|
||||
@@ -64,5 +65,6 @@ app.ws('/ws', async (req, res) => {
|
||||
app.listen(port, () => {
|
||||
console.info({ event: 'startup', visit: `http://localhost:${port}/menu/` })
|
||||
|
||||
Dungeon.scenario(game)
|
||||
LEVEL.Chase.scenario(game)
|
||||
game.start()
|
||||
})
|
||||
|
||||
+17
-6
@@ -26,8 +26,24 @@ export class Dungeon {
|
||||
game.spawnEntity(new Entity(Template.player({ id: '2', spawnPosition: new Vector2(1500, 700), team, dead: true })))
|
||||
|
||||
game.spawnEntity(new Entity(Template.basilisk({ id: 'boss', spawnPosition: new Vector2(2200, 750), team: Team.neutral })))
|
||||
}
|
||||
}
|
||||
|
||||
game.start()
|
||||
export class Chase {
|
||||
static scenario(game) {
|
||||
game.width = 1000
|
||||
game.height = 1000
|
||||
|
||||
const chaserTemplate = {
|
||||
// TODO: TODO
|
||||
}
|
||||
|
||||
const runnerTemplate = {
|
||||
// TODO: TODO
|
||||
}
|
||||
|
||||
game.spawnEntity(new Entity({ ...chaserTemplate }))
|
||||
game.spawnEntity(new Entity({ ...runnerTemplate }))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,9 +63,6 @@ export class Zigzag {
|
||||
new Vector2(i + 100, game.height - lowest),
|
||||
]))
|
||||
}
|
||||
|
||||
|
||||
game.start()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,8 +81,6 @@ export class Ravine {
|
||||
team,
|
||||
})))
|
||||
}
|
||||
|
||||
game.start()
|
||||
}
|
||||
static logic() {
|
||||
const game = this
|
||||
|
||||
Reference in New Issue
Block a user