I'm making a game in which the world is generated randomly and it's infinite. I generate a 640x480 level png image when I need to and save it to a local folder.
The problem is that I need to reload these images on the fly as the game is running.
I figured out I need to use threads to load this images. The problem is that I don't know much about threads on LÖVE.
I have this on my main.lua
Code: Select all
channel = love.thread.getChannel("CHAN1");
thread = love.thread.newThread("thread.lua");
thread:start(); channel:push("uno.png");
IMG = channel:demand();
print(IMG);
Code: Select all
local channel = love.thread.getChannel("CHAN1");
local file = channel:demand();
local img = love.graphics.newImage(file);
channel:push(img);
So the IMG variable should contain an image object.
But the print in the main.lua file it's printing "uno.png", as no thread loaded any image.
What am I doing wrong?