This commit is contained in:
Schluffe
2026-02-19 20:59:10 +01:00
parent 8ea950db5a
commit c95621072c
14 changed files with 264 additions and 319 deletions
+5 -15
View File
@@ -1,20 +1,10 @@
import { createAnimation, playAnimation } from "#/engine/Animation.ts";
import { defineEntity } from "#/engine/Entity.ts";
import { fromSrc, type Sprite } from "#/engine/Sprite.ts";
import { loadImage } from "#/engine/lib/loadImage.ts";
import { createSpriteAnimation, createSpritesSheet } from "#/engine/sprites.ts";
import portal from "#/game/assets/portal.png";
const sprite: Sprite = await fromSrc(portal, 3, 1);
const portalSheet = createSpritesSheet(await loadImage(portal), 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,
);
defineEntity("portal", {
animation: createSpriteAnimation(portalSheet, 400, 0),
});