Stabilize unit facing and movement feedback

This commit is contained in:
2026-06-28 22:15:26 +09:00
parent 49ce0746cd
commit 66fc9984e5
185 changed files with 168 additions and 19 deletions

View File

@@ -5,8 +5,6 @@ export type UnitDirection = 'south' | 'east' | 'north' | 'west';
const unitWalkFrameCount = 4;
export const unitSheetFrameSize = 313;
const unitWalkFrameRate = 8;
const unitIdleFrameRate = 4;
const unitSheetRows: Record<UnitDirection, number> = {
south: 0,
east: 1,
@@ -98,6 +96,7 @@ export function ensureUnitAnimations(scene: Phaser.Scene, keys: Iterable<string>
key,
frame: unitSheetRows[direction] * unitWalkFrameCount + frameIndex
}));
const idleFrame = [{ key, frame: unitSheetRows[direction] * unitWalkFrameCount }];
const walkAnimationKey = `${key}-walk-${direction}`;
const idleAnimationKey = `${key}-idle-${direction}`;
@@ -113,9 +112,9 @@ export function ensureUnitAnimations(scene: Phaser.Scene, keys: Iterable<string>
if (!scene.anims.exists(idleAnimationKey)) {
scene.anims.create({
key: idleAnimationKey,
frames,
frameRate: unitIdleFrameRate,
repeat: -1
frames: idleFrame,
frameRate: 1,
repeat: 0
});
}
});