Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

356 B
Raw Blame
import { defineSystem, Query, Mut, Text } from 'esengine';
import { ScoreDisplay } from '../components';

export const scoreSystem = defineSystem(
    [Query(ScoreDisplay, Mut(Text))],
    (query) => {
        for (const [_entity, score, text] of query) {
            text.content = `Score: ${score.score}`;
        }
    },
    { name: 'ScoreSystem' }
);