i have loaded a bunch of character animations for my game into a table like this:
Code: Select all
images = {
world = {
player = {
idle = {
down = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/idle_down.png" ), 25, 50, 0.1),
up = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/idle_up.png" ), 25, 50, 0.1),
right = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/idle_right.png" ), 25, 50, 0.1),
left = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/idle_left.png" ), 25, 50, 0.1),
},
walk = {
right = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/walk_right.png" ), 25, 50, 0.1),
left = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/walk_left.png" ), 25, 50, 0.1),
up = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/walk_up.png" ), 25, 50, 0.1),
down = love.graphics.newAnimation(love.graphics.newImage( "tiles/character/walk_down.png" ), 25, 50, 0.1),
},
},
}
Code: Select all
images.world.player[self.state][self.facing]:update(dt)
But it doesn't work. I get this error "Error in update (arg 2), expected 'float' got 'nil'"
And it's directed at the line with the animation update. I've used animations before and so I
m baffled as to what's causing this. The only differences right now is that I have all of my images loaded into a series of tables, and I update my animations with a player:draw() method instead of in the main draw() function, although I get the same error if I try it there.
Can someone perhaps provide some insight for me? I'm completely lost.