local Timer = require("hump.timer")
local Potato2 = ""
function love.keypressed(key)
if key == 'a' then
Timer.after(1, function() Potato2 = ("potato2.png") end)
end
end
function love.update(dt)
Timer.update(dt)
end
function love.draw()
love.graphics.draw(Potato2)
end
Error
main.lua:13: bad argument #1 to 'draw' (Drawable expected, got string)
Traceback
[C]: in function 'draw'
main.lua:13: in function 'draw'
[C]: in function 'xpcall'
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
local Timer = require("hump.timer")
right = love.graphics.newImage("potatoes/right.png")
right2 = love.graphics.newImage("potatoes/right2.png")
left = love.graphics.newImage("potatoes/left.png")
left2 = love.graphics.newImage("potatoes/left2.png")
potato = right
x = 50
y = 50
speed = 300
function love.keypressed(key)
if key == 'd' then
Timer.after(1, function() potato = right2 end)
end
end
function love.update(dt)
Timer.update(dt)
end
function love.draw()
love.graphics.draw(potato)
end
However I still can't figure out how to make the image move (I keep getting errors about being unable to use arithmetic and global values).
Last edited by BobTheBuilder on Fri Jan 04, 2019 12:22 pm, edited 1 time in total.
BobTheBuilder wrote: ↑Fri Jan 04, 2019 11:11 am
However I still can't figure out how to make the image move (I keep getting errors about being unable to use arithmetic in global values).
I'm 100%sure that's not what the error message says though; it may be complaining that a value is nil or something else that you can't indeed perform arithmetic with; you'd need to show code and the actual error message with the line number to make life easier for all of us... up to a point; that said, i'll leave it up to you whether you want to hijack this thread for the duration of this, or if you'll open a new thread for it.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.