Files
nage/entities/portal/entity.ts
T
2026-01-23 14:21:21 +01:00

20 lines
479 B
TypeScript

import { createAnimation, playAnimation } from "#/engine/Animation.ts";
import { defineEntity } from "#/engine/Entity.ts";
import { fromSrc, type Sprite } from "#/lib/Sprite.ts";
const sprite: Sprite = await fromSrc("./assets/portal.png", 3, 1);
const { animate } = defineEntity("portal", {
animation: createAnimation(sprite, 400, 0),
});
animate((entity, ctx, delta) => {
playAnimation(
ctx,
entity.animation,
entity.position.x,
entity.position.y,
delta,
);
});