From a553ef99c6594c2d3f9e1a09ae2329cf00660bb1 Mon Sep 17 00:00:00 2001 From: cha0s Date: Wed, 3 Jul 2024 21:57:07 -0500 Subject: [PATCH] feat: player --- app/create-player.js | 1 + app/ecs-components/player.js | 3 +++ public/assets/shit-shack/collision-start.js | 20 +++++++++++--------- 3 files changed, 15 insertions(+), 9 deletions(-) create mode 100644 app/ecs-components/player.js diff --git a/app/create-player.js b/app/create-player.js index e3a930d..5b90e87 100644 --- a/app/create-player.js +++ b/app/create-player.js @@ -41,6 +41,7 @@ export default async function createPlayer(id) { }, Health: {health: 100}, Magnet: {strength: 24}, + Player: {}, Position: {x: 128, y: 128}, Speed: {speed: 100}, Sound: {}, diff --git a/app/ecs-components/player.js b/app/ecs-components/player.js new file mode 100644 index 0000000..0bb6007 --- /dev/null +++ b/app/ecs-components/player.js @@ -0,0 +1,3 @@ +import Component from '@/ecs/component.js'; + +export default class Player extends Component {} diff --git a/public/assets/shit-shack/collision-start.js b/public/assets/shit-shack/collision-start.js index beaf9b3..56747c9 100644 --- a/public/assets/shit-shack/collision-start.js +++ b/public/assets/shit-shack/collision-start.js @@ -1,16 +1,18 @@ for (let i = 0; i < intersections.length; ++i) { if (intersections[i][0].tags) { if (intersections[i][0].tags.includes('door')) { - ecs.switchEcs( - other, - entity.Ecs.path, - { - Position: { - x: 72, - y: 304, + if (other.Player) { + ecs.switchEcs( + other, + entity.Ecs.path, + { + Position: { + x: 72, + y: 304, + }, }, - }, - ); + ); + } } } }