so this is my code:
function love.load()
love.window.setMode(1920, 1080, {resizable=false, fullscreen=true, vsync=false, minwidth=1920, minheight=1080})
harmony = {}
harmony.sprite = love.image.newImageData("Sprites/Harmony.png")
harmony.bg = love.image.newImageData("Sprites/HarmonyBg.png")
end
function love.update(dt)
if love.keyboard.isDown("escape") then
love.event.quit()
end
end
function love.draw()
love.graphics.draw(harmony.bg, 0, 0)
love.graphics.draw(harmony.sprite, 860, -920)
end
i have been getting this error message:
main.lua:15: bad argument #1 to 'draw' (Drawable expected, got ImageData)
Can somebody help me? i am stuck!
I get a wierd error i havent seen anywhere
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 5
- Joined: Wed Jul 27, 2022 12:26 pm
Re: I get a wierd error i havent seen anywhere
Well, the error code says it all - ImageData is not drawable. Drawable derivatives are (as of this writing): Canvas, Framebuffer, Image, Mesh, ParticleSystem, SpriteBatch, Text, Texture and Video. As you can see, ImageData is none of these.
Try making an image out of the imagedata, or loading the files into Image instances rather than into ImageData instances:
-or-
depending on whether you're going to need the image data later.
Try making an image out of the imagedata, or loading the files into Image instances rather than into ImageData instances:
Code: Select all
harmony.spritedata = love.image.newImageData("Sprites/Harmony.png")
harmony.bgdata = love.image.newImageData("Sprites/HarmonyBg.png")
harmony.sprite = love.graphics.newImage(harmony.spritedata)
harmony.bg = love.graphics.newImage(harmony.bgdata)
Code: Select all
harmony.sprite = love.graphics.newImage("Sprites/Harmony.png")
harmony.bg = love.graphics.newImage("Sprites/HarmonyBg.png")
-
- Prole
- Posts: 5
- Joined: Wed Jul 27, 2022 12:26 pm
Re: I get a wierd error i havent seen anywhere
thanks for solving my problem, pgimeno! it really blocked development!
Who is online
Users browsing this forum: Bing [Bot] and 2 guests