This commit is contained in:
Schluffe
2026-02-25 00:58:53 +01:00
parent 51a0fe38ef
commit 9ab90b579c
9 changed files with 166 additions and 74 deletions
+11 -1
View File
@@ -5,6 +5,7 @@ import { keyboardInput } from "#/engine/Keyboard.ts";
import { pointer } from "#/engine/Pointer.ts";
import {
createSpriteAnimation,
type Sprite,
type SpriteAnimation,
useSpriteSheetSrc,
} from "#/engine/Sprite.ts";
@@ -15,17 +16,26 @@ export type Hero = {
position: Vector;
velocity: Vector;
body: Circle;
sprite: Sprite;
animation: SpriteAnimation;
};
const speed = 0.05;
const idleSheet = await useSpriteSheetSrc(charIdle, 2, 4);
const sprite = {
src: idleSheet,
xStart: 0,
yStart: 0,
width: 16,
height: 16,
};
const state: Hero = {
position: createVector(),
velocity: createVector(),
body: createCircle(createVector(), 4),
animation: createSpriteAnimation(idleSheet, 500, 2),
sprite,
animation: createSpriteAnimation(sprite, 500, 2),
};
const process = defineEntity("hero", state);