Animation update error
Posted: Mon Aug 17, 2009 3:18 pm
Oh god, I don't know why this is happening but it's driving me insane.
i have loaded a bunch of character animations for my game into a table like this:
And I update my animations thusly:
Where [self.state] is a string that with the values or either "idle" or "walk and [self.facing] has "up, "down".. etc.
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.
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.