Page 1 of 1

libraries/anim8.lua:256: attempt to call field 'drawq' (a nil value)

Posted: Mon Jul 08, 2024 7:36 am
by Jan Rui
Hi.. can anyone help me with this.. I just started game development and I've been stuck for hours with this error. :cry:
libraries/anim8.lua:256: attempt to call field 'drawq' (a nil value)
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?
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

Re: libraries/anim8.lua:256: attempt to call field 'drawq' (a nil value)

Posted: Mon Jul 08, 2024 12:01 pm
by togFox
If you zip up your code and paste it here, including images, I'll see if there is something obvious.

Re: libraries/anim8.lua:256: attempt to call field 'drawq' (a nil value)

Posted: Mon Jul 08, 2024 12:11 pm
by DaedalusYoung
love.graphics.drawq was removed in 0.9.0. You should just be able to change it to love.graphics.draw.

Re: libraries/anim8.lua:256: attempt to call field 'drawq' (a nil value)

Posted: Mon Jul 08, 2024 12:31 pm
by togFox
https://github.com/kikito/anim8

Even better - get the latest version.