Something went wrong. Try again.
Experimental canvas 2D engine for tile-based sidescroller/sandbox games, created strictly for educational purposes.
entity-component-system game-engine canvas-2d
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930import { Cosmic, Entity, System } from "@cosmic/core";import { Name } from "@cosmic/kit/components";
export class LoggingSystem extends System { private worldStore: Map<string, any>;
constructor(engine: Cosmic) { super();
this.worldStore = engine.getStore("cosmic.world"); }
public readonly requiredComponents = new Set([Name.name]);
public update(entities: Entity[], _deltaTime: number) { for (const entity of entities) { console.log(` ==================== Entity ==================== ID: ${entity.id} Name: '${entity.getComponent(Name)?.name}' Description: '${entity.getComponent(Name)?.description}'
=============== World Properties =============== Gravitational Strength: ${this.worldStore.get("cosmic.world.gravity.strength") ?? 0} Cell Size: ${this.worldStore.get("cosmic.world.grid.cellSize") ?? 0} `); } }}