I don't think there a problem with the code and the size of the sprite sheet is also correct.. what do you guys think the problem is?libraries/anim8.lua:256: attempt to call field 'drawq' (a nil value)
Here's my code..thanks! appreciate anyone who help..
Code: Select all
function love.load()
anim8 = require 'libraries/anim8'
player = {}
player.x = 400
player.y = 200
player.speed = 10
player.spriteSheet = love.graphics.newImage('sprites/player-sprites.png')
player.grid = anim8.newGrid(16, 18, player.spriteSheet:getWidth(), player.spriteSheet:getHeight())
player.animation = {}
player.animation.down = anim8.newAnimation(player.grid('1-3', 1), 0.2 )
background = love.graphics.newImage('sprites/background.png')
end
function love.update(dt)
if love.keyboard.isDown("d") then
player.x = player.x + player.speed
end
if love.keyboard.isDown("a") then
player.x = player.x - player.speed
end
if love.keyboard.isDown("w") then
player.y = player.y - player.speed
end
if love.keyboard.isDown("s") then
player.y = player.y + player.speed
end
player.animation.down:update(dt)
end
function love.draw()
love.graphics.draw(background, 0, 0)
player.animation.down:draw(player.spriteSheet, player.x, player.y)
end