add terrain collision
This commit is contained in:
+7
-11
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user