randomize first frame of idle animation

This commit is contained in:
PeaAshMeter 2026-04-13 03:31:49 +03:00
parent 4761446e73
commit e597f8da20

View File

@ -93,6 +93,9 @@ function sprite:loop(state)
return print("[SpriteBehavior]: no animation for '" .. state .. "'") return print("[SpriteBehavior]: no animation for '" .. state .. "'")
end end
self.animationTable[state] = anim8.newAnimation(self.animationGrid[state], self.ANIMATION_SPEED) self.animationTable[state] = anim8.newAnimation(self.animationGrid[state], self.ANIMATION_SPEED)
if state == 'idle' then
self.animationTable[state]:gotoFrame(love.math.random(#self.animationTable[state].frames))
end
self.state = state self.state = state
end end