Coin.ts

src/objects/Coin.ts
import { Container, Graphics } from 'pixi.js';
import * as TWEEN from '@tweenjs/tween.js';
import type RAPIER from '@dimforge/rapier2d-compat';
import { COIN_RADIUS, COLORS } from '../constants';
import type { PhysicsWorld } from '../systems/PhysicsWorld';
/**
* Sensor pickup. Fixed Rapier body with a sensor ball collider that fires a
* collision-start event when the player overlaps it. The display object is a
* tiny Graphics circle that bobs via tween.js.
*/
export class Coin extends Container {
readonly body: RAPIER.RigidBody;
readonly collider: RAPIER.Collider;
private bobTween?: TWEEN.Tween<Container>;
constructor(
private physics: PhysicsWorld,
x: number,
y: number,

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