Kevsoft wrote:Please test if the image is valid. I could only think that Graphics.loadImage somehow fails
The image is valid. As I said, the override is successful unless I start the test using "Test in SMBX" function of the PGE editor. I just tested to make sure, and no matter where I start the test from, the image loads. Unless a test from PGE makes it load the image in the wrong format somehow, this is not the problem.
PixelPest wrote:Could you maybe post the code?
Code: Select all
function layers.draw()
if layers.debug then
for _,v in pairs(nodes) do
Graphics.drawImageToScene(debugImg, v.x, v.y)
textblox.printExt(v.id, {x = v.x + 16, y = v.y + 16, font = textblox.FONT_SPRITEDEFAULT3X2, bind = textblox.BIND_LEVEL})
end
else
if not frame then
Graphics.sprites.background[anchor].img = Graphics.loadImage(Misc.resolveFile("blank.png")) -- Add this file to a folder in luaScriptsLib
frame = true
end
end
end
This function is part of an API, and it is registered to the onDraw event.
debugImg is an image resource, and anchor is the ID of a BGO.
Actually, that's not the only problem I have with this API. What this API does is, it introduces a position-based layer movement system to SMBX. The trouble is, the layers don't want to stop moving once they start moving. It sets the x and y speeds to 0.0001 when I tell them to stop. This slowly but surely messes up the positions of the layers. Sometimes, the layers will just "twitch" like crazy instead of stopping, sending Mario flying to the left or right at high speeds when he touches them. The only thing I can do is continually set the speed to move the layer back to the desired position, but this sometimes causes an overflow crash.
Here is a paste of the whole code:
http://hastebin.com/ekofuqarud.lua