src/objects/Player.tsimport { Container, Graphics } from 'pixi.js';import type RAPIER from '@dimforge/rapier2d-compat';import { COLORS, PLAYER_HALF_SIZE, PLAYER_SPEED } from '../constants';import type { PhysicsWorld } from '../systems/PhysicsWorld';/*** Example player entity: a Pixi Container holding a Graphics shape, paired* with a Rapier kinematic body.** Pattern: each frame, scene.update() reads input, calls player.move(dir),* then steps physics, then calls player.sync() to copy the body's* translation back onto the sprite.** Replace the Graphics shape with a Sprite + texture once you have art.*/export class Player extends Container {readonly body: RAPIER.RigidBody;readonly collider: RAPIER.Collider;constructor(
Showing the first 20 lines.
Get full code