add player rotation display

This commit is contained in:
JOLIMAITRE Matthieu 2024-10-20 22:27:03 +02:00
parent bfb92c513d
commit e502ca00de
3 changed files with 9 additions and 5 deletions

View file

@ -55,6 +55,9 @@ export class Session {
move(direction: Vec2) {
const pos = this.entity.get_force(CompPos);
pos.move_collide(this.engine, direction);
const display = this.entity.get_force(CompDisplay);
if (direction.x() > 0) display.update("P/");
if (direction.x() < 0) display.update("\\P");
}
}
@ -64,7 +67,7 @@ export function sys_spawn_player(position: Vec2) {
entity.insert(
new CompPlayer(),
new CompPos(entity, position),
new CompDisplay("`/"),
new CompDisplay("P/"),
)
);
};