Improve handpainted battle unit readability
This commit is contained in:
@@ -7,7 +7,6 @@ const unitWalkFrameCount = 8;
|
||||
export const unitBaseFramesPerDirection = unitIdleFrameCount + unitWalkFrameCount;
|
||||
export const unitSheetFrameSize = 313;
|
||||
const unitWalkFrameRate = 10;
|
||||
const unitIdleFrameRate = 5;
|
||||
const unitSheetRows: Record<UnitDirection, number> = {
|
||||
south: 0,
|
||||
east: 1,
|
||||
@@ -99,10 +98,12 @@ export function ensureUnitAnimations(scene: Phaser.Scene, keys: Iterable<string>
|
||||
key,
|
||||
frame: unitSheetRows[direction] * unitBaseFramesPerDirection + unitIdleFrameCount + frameIndex
|
||||
}));
|
||||
const idleFrames = Array.from({ length: unitIdleFrameCount }, (_, frameIndex) => ({
|
||||
key,
|
||||
frame: unitSheetRows[direction] * unitBaseFramesPerDirection + frameIndex
|
||||
}));
|
||||
const idleFrames = [
|
||||
{
|
||||
key,
|
||||
frame: unitSheetRows[direction] * unitBaseFramesPerDirection
|
||||
}
|
||||
];
|
||||
const walkAnimationKey = `${key}-walk-${direction}`;
|
||||
const idleAnimationKey = `${key}-idle-${direction}`;
|
||||
|
||||
@@ -119,7 +120,7 @@ export function ensureUnitAnimations(scene: Phaser.Scene, keys: Iterable<string>
|
||||
scene.anims.create({
|
||||
key: idleAnimationKey,
|
||||
frames: idleFrames,
|
||||
frameRate: unitIdleFrameRate,
|
||||
frameRate: 1,
|
||||
repeat: -1
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user