local this_thread = love.thread.getThread()
local msg = this_thread:receive("ping")
while (true) do
if (msg) then
this_thread:send("response", true)
end
end
It only checks for ping at startup, that loop will never update msg.
Also, it's a busy loop, I'd go for demand instead.
local this_thread = love.thread.getThread()
local msg = this_thread:demand("ping")
while (true) do
if (msg) then
this_thread:send("response", true)
end
end
function eventtimer(dt)
time = time + (timerspeed * dt)
--EVENT 1
if time >= 1500 then
layerdecayactive = true
end
--EVENT 2
if time >= 1400 then
--play music
-- love.audio.play(music4)
musicload:send("ping", true)
response = musicload:demand("response")
if (message) then
love.graphics.setBackgroundColor(255,255,255)
end
--initiate sound management
soundcontrolactive = true
end
end
...still didn't do anything. The Background Color remains (0,0,0)
local this_thread = love.thread.getThread()
while (true) do
local msg = this_thread:demand("ping")
if (msg) then
this_thread:send("response", true)
end
end
In the loop! Also, if your game doesn't hang using demand, it means the thread has either errored or replied, in your case I'd expect an error occurred. Try receiving the "error" variable for that.
Yeah, I was expecting this. I tried it both ways, in the loop and out of the loop, and both didn't work. The game doesn't get stuck or changes the background-color.
Sorry for asking such a noobish question... but what do you mean by getting the "error" variable? Just:
function eventtimer(dt)
time = time + (timerspeed * dt)
--EVENT 1
if time >= 1500 then
layerdecayactive = true
end
--EVENT 2
if time >= 1400 then
--play music
-- love.audio.play(music4)
musicload:send("ping", true)
response = musicload:demand("response")
errormsg = musicload:receive("error")
love.graphics.printf(errormsg, 10, 10,( maxx - 10), "left")
if (message) then
love.graphics.setBackgroundColor(255,255,255)
end
end
end