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.

607 B
Raw Blame
import { defineEvent, type Entity } from 'esengine';

/**
 * Everything that hurts anything goes through here, so invulnerability frames,
 * death and (later) hit reactions exist once instead of once per attacker.
 */
export const DamageDealt = defineEvent<{
    target: Entity;
    amount: number;
    /** Where the blow came from, for knockback and hit sparks. */
    fromX: number;
    fromY: number;
}>('DamageDealt', { target: 0 as Entity, amount: 0, fromX: 0, fromY: 0 });

export const Died = defineEvent<{ entity: Entity; isPlayer: boolean }>(
    'Died', { entity: 0 as Entity, isPlayer: false });