New to love2d, and enjoying it. Im using aim8 which is working out really well. I have a question about durations.
I can't seem to change the duration of animation once its created. How would I do this? For instance, I want to slow the animation down when the user presses the down key.
Code: Select all
-- setup animation frames
player.left_anim_frames = {
atlas.quads['player_left_01'],
atlas.quads['player_left_02']
}
player.right_anim_frames = {
atlas.quads['player_right_01'],
atlas.quads['player_right_02']
}
player.center_anim_frames = {
atlas.quads['player_center_01'],
atlas.quads['player_center_02']
}
-- create animation
player.animation = anim8.newAnimation(player.center_anim_frames, 0.25)
player.animation['left'] = anim8.newAnimation(player.left_anim_frames, 0.25)
player.animation['right'] = anim8.newAnimation(player.right_anim_frames, 0.25)
player.animation['up'] = anim8.newAnimation(player.center_anim_frames, 0.1)
player.animation['down'] = anim8.newAnimation(player.center_anim_frames, 0.5)
Code: Select all
if love.keyboard.isDown("down") then
if self.animation.current ~= self.animation['down'] then
self.animation.current = self.animation['down']
end
end
Thanks!