Player.ts

src/objects/Player.ts
import { 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

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC