fix: reduce fighter sprite scale on mobile canvas
On narrow viewports (<600px), fighters were oversized due to the desktop scale formula. Use reduced base (1.1) and tier (0.2) scale factors on mobile while keeping desktop unchanged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a2416bbe19
commit
761c01f92f
@@ -468,10 +468,15 @@ export async function createFightScene(config: FightSceneConfig) {
|
|||||||
'judge',
|
'judge',
|
||||||
])
|
])
|
||||||
|
|
||||||
const scaleA = (FIGHTER_BASE_SCALE + botA.tier * FIGHTER_TIER_SCALE) * SF
|
// On mobile (narrow canvas), reduce fighter size so they fit the viewport
|
||||||
|
const isMobileCanvas = W < 600
|
||||||
|
const fBase = isMobileCanvas ? 1.1 : FIGHTER_BASE_SCALE
|
||||||
|
const fTier = isMobileCanvas ? 0.2 : FIGHTER_TIER_SCALE
|
||||||
|
|
||||||
|
const scaleA = (fBase + botA.tier * fTier) * SF
|
||||||
k.add([k.sprite('botA', { anim: 'idle' }), k.pos(-100, GROUND_Y - 6), k.anchor('bot'), k.scale(scaleA), k.z(10), k.opacity(0), 'fighterA'])
|
k.add([k.sprite('botA', { anim: 'idle' }), k.pos(-100, GROUND_Y - 6), k.anchor('bot'), k.scale(scaleA), k.z(10), k.opacity(0), 'fighterA'])
|
||||||
|
|
||||||
const scaleB = (FIGHTER_BASE_SCALE + botB.tier * FIGHTER_TIER_SCALE) * SF
|
const scaleB = (fBase + botB.tier * fTier) * SF
|
||||||
k.add([k.sprite('botB', { anim: 'idle' }), k.pos(W + 100, GROUND_Y - 6), k.anchor('bot'), k.scale(-scaleB, scaleB), k.z(10), k.opacity(0), 'fighterB'])
|
k.add([k.sprite('botB', { anim: 'idle' }), k.pos(W + 100, GROUND_Y - 6), k.anchor('bot'), k.scale(-scaleB, scaleB), k.z(10), k.opacity(0), 'fighterB'])
|
||||||
|
|
||||||
config.onReady?.()
|
config.onReady?.()
|
||||||
|
|||||||
Reference in New Issue
Block a user