hi I'm back again. Thanks for the previous answers they helped me understand the engine better. I have another question now.
I have a script thats under the game_manager file, so when the game starts the game_manager loads it, like the dialogue_box file. other than the constructor I have only one function in there which I call from an item. it's supposed to show a picture. the function is successfully called, no problem there, but an error occurs when attempting to show the picture:
Error: In timer callback: [string "scripts/picture.lua"]:26: bad argument #1 to 'draw' (sol.surface expected, got nil)
and I tried it with the exact code from the first tutorial with the challenge_accepted picture and it doesn't seem to be loading my picture at all. this is the function
function picture_manager:show_picture()
local hello_1 = sol.surface.create("hello.png")
hello_1:draw(screen,50,50)
end
I don't know LUA very well so I'm not sure how to check how the function is working (though I'm assuming it does not load the picture because when attempting to draw, it is nil). Should I be using something different because it's a child of game_manager which is a child of main? Since it works fine on main, but not here. Or am I doing something else totally wrong?
EDIT: Please ignore all of the above I am very dumb. I forgot this crucial part:
function sol.main:on_draw(screen)
end
However, that still brings me to my other question: every time I want to draw a file to the screen, do I have to encase it in this function? Furthermore, I see that trying to use .JPGs causes the game to crash, so I assume the engine can't handle the image data of a jpeg. Is there documentation on what files that it accepts on the create function? In the documentation it does not specify what files are able to be loaded through sol.surface.create.
Question 2: Is it possible to have z-indices for pictures? Like make a picture show behind the dialogue box, or to switch a picture's z-index to have one on top of another? Or is it because the surface IS the entire screen that it goes over everything and is therefore impossible?