controller.script code
function init(self)
-- Make sure stage1-1 starts disabled (if needed)
msg.post("main:/controller#stage1-1", "load")
end
function on_message(self, message_id, message, sender)
if message_id == hash("enable_stage1_1") then
msg.post("main:/controller#stage1-1", "enable")
elseif message_id == hash("disable_stage1_1") then
msg.post("main:/controller#stage1-1", "disable")
elseif message_id == hash("enable_stage1_2") then
msg.post("main;/controller#stage1-2", "enable")
elseif message_id == hash("disable_stage1_2") then
msg.post("main:/controller#stage1-2", "disable")
elseif message_id == hash("enable_stage1_3") then
msg.post("main:/controller#stage1-3", "enable")
elseif message_id == hash("disable_stage1_3") then
msg.post("main:/controller#stage1-3", "disable")
end
end
also the boundary script code
function on_message(self, message_id, message, sender)
if message_id == hash("collision_response") and message.group == hash("player") then
msg.post("main:/controller#stage1-1", "enable")
msg.post("game:/valley#stage1", "disable")
elseif message_id == hash("collision_response") and message.group == hash("player") then
msg.post("main://controller#stage1-2", "enable")
msg.post("game://controller#stage1-1", "disabld")
-- messages the controller scrip to not load the previous level
local player_spawn_position = vmath.vector3(100, 200, 0) -- sets the spawn of the player in the next level
go.set_position(player_spawn_position, "player") --same as above
end
end