FCK
This commit is contained in:
@@ -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),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user