function init()	

	--Find handles to the light switch and and lamp
	switch = FindShape("switch")

        boxb1 = FindBody("sosbox")

	--The light should start turned off
	on = false
	SetTag(switch, "interact", "Call")

	--Load sounds from the game asset folder (data/snd)
	onSound = LoadSound("MOD/main/snd/sos.ogg")
	offSound = LoadSound("screen-off.ogg")
end


function tick()

        local t = GetBodyTransform(boxb1)

	--Check if player interacts with light switch and presses interact button
	if GetPlayerInteractShape() == switch and InputPressed("interact") then

		--Turn light on or off, depending on the current state
		if on then
			on = false
			PlaySound(offSound)
			SetTag(switch, "interact", "Call")
		else
			on = true
			PlaySound(onSound, t.pos, 50)
			PlaySound(offSound)
			SetTag(switch, "interact", "End the call")
		end
		
	end
end

