summaryrefslogtreecommitdiffstats
path: root/src/view/entity.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/view/entity.ts')
-rw-r--r--src/view/entity.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/view/entity.ts b/src/view/entity.ts
index 7600826..83cd955 100644
--- a/src/view/entity.ts
+++ b/src/view/entity.ts
@@ -14,9 +14,10 @@ export async function loadEntity(
const sprites: SpriteView[] = [];
for (let frame = 0; frame < data.frames; frame++) {
- const [texture, size, coords] = mkTexture(r, tile, frame, data.frames);
+ const [texture, coords] = mkTexture(r, tile, frame, data.frames);
- const offset = vec2.mul(vec2.create(), data.anchor, size);
+ const offset = vec2.fromValues(coords[2] - coords[0], coords[3] - coords[1]);
+ vec2.mul(offset, offset, data.anchor);
r.snapToGrid(offset, offset);
const anchorCoords: SpriteCoords = [