add terrain collision

This commit is contained in:
2024-12-23 18:30:59 +09:00
parent ae6f4c2847
commit 37a77e902c
5 changed files with 51 additions and 24 deletions
+7 -11
View File
@@ -42,25 +42,21 @@ app.listen(port, () => {
const entity1 = new Entity()
entity1.id = '1'
entity1.teleport(100, 100)
entity1.radius = 35
entity1.teleport(350, 500)
entity1.radius = 50
game.spawn_entity(entity1)
const entity2 = new Entity()
entity2.id = '2'
entity2.teleport(200, 100)
entity2.teleport(800, 100)
entity2.radius = 35
game.spawn_entity(entity2)
const vertices = [
{ x: 0, y: 0 },
{ x: 20, y: 0 },
{ x: 20, y: 20 },
{ x: 10, y: 20 },
{ x: 10, y: 5 },
{ x: 5, y: 5 },
{ x: 5, y: 20 },
{ x: 0, y: 20 },
{ x: 400, y: 400 },
{ x: 600, y: 400 },
{ x: 600, y: 600 },
{ x: 400, y: 600 },
]
const terrain1 = new Terrain(vertices)