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

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Jan Rui
Prole
Posts: 1
Joined: Mon Jul 08, 2024 7:25 am

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

Post 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
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

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

Post by togFox »

If you zip up your code and paste it here, including images, I'll see if there is something obvious.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
User avatar
DaedalusYoung
Party member
Posts: 413
Joined: Sun Jul 14, 2013 8:04 pm

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

Post by DaedalusYoung »

love.graphics.drawq was removed in 0.9.0. You should just be able to change it to love.graphics.draw.
User avatar
togFox
Party member
Posts: 828
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

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

Post by togFox »

https://github.com/kikito/anim8

Even better - get the latest version.
Last project:
https://togfox.itch.io/hwarang
A card game that brings sword fighting to life.
Current project:
Idle gridiron. Set team orders then idle and watch: https://togfox.itch.io/idle-gridiron
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests