feat: player

This commit is contained in:
cha0s 2024-07-03 21:57:07 -05:00
parent 4a7006a48d
commit a553ef99c6
3 changed files with 15 additions and 9 deletions

View File

@ -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: {},

View File

@ -0,0 +1,3 @@
import Component from '@/ecs/component.js';
export default class Player extends Component {}

View File

@ -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,
},
},
},
);
);
}
}
}
}