F key launches first inventory item toward mouse cursor as projectile. Projectiles travel at 350px/s, expire after 2s, destroyed on hitting non-walkable tiles. Color matches element's periodic table color. 13 new tests (198 total). Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
/**
|
|
* ECS Components — plain objects with number arrays (bitECS 0.4 pattern)
|
|
*
|
|
* Components define the data schema for entities.
|
|
* Systems read/write component data.
|
|
* Bridge syncs component data to Phaser rendering.
|
|
*/
|
|
|
|
/** World position in pixels */
|
|
export const Position = {
|
|
x: [] as number[],
|
|
y: [] as number[],
|
|
};
|
|
|
|
/** Movement velocity in pixels per second */
|
|
export const Velocity = {
|
|
vx: [] as number[],
|
|
vy: [] as number[],
|
|
};
|
|
|
|
/** Visual representation — used by bridge to create/update Phaser objects */
|
|
export const SpriteRef = {
|
|
color: [] as number[], // hex color (e.g. 0x00ff88)
|
|
radius: [] as number[], // circle radius in pixels
|
|
};
|
|
|
|
/** Entity health — damage, healing, death */
|
|
export const Health = {
|
|
current: [] as number[],
|
|
max: [] as number[],
|
|
};
|
|
|
|
/** Link to chemistry system — stores atomic number of primary element */
|
|
export const ChemicalComposition = {
|
|
primaryElement: [] as number[], // atomic number (e.g. 11 for Na)
|
|
};
|
|
|
|
/** Tag component — marks entity as the player (no data, identity only) */
|
|
export const PlayerTag = {
|
|
_tag: [] as number[],
|
|
};
|
|
|
|
/** Harvestable resource — mineral veins, geysers, etc. */
|
|
export const Resource = {
|
|
quantity: [] as number[], // remaining items to collect
|
|
interactRange: [] as number[], // max interaction distance in pixels
|
|
};
|
|
|
|
/** Thrown element/compound projectile */
|
|
export const Projectile = {
|
|
lifetime: [] as number[], // remaining lifetime in ms (removed at 0)
|
|
};
|