function init(self)
	-- Add initialization code here
	-- Learn more: https://defold.com/manuals/script/
	-- Remove this function if not needed
	gui.set_text(gui.get_node("x_pos"), "--") --self.velocity.x)
end

function final(self)
	-- Add finalization code here
	-- Learn more: https://defold.com/manuals/script/
	-- Remove this function if not needed
end

function update(self, dt)
	-- Add update code here
	-- Learn more: https://defold.com/manuals/script/
	-- Remove this function if not needed
end

function on_message(self, message_id, message, sender)
	if message_id == hash("set_vars") then
		gui.set_text(gui.get_node("x_pos"), message.x)
		gui.set_text(gui.get_node("y_pos"), message.y)
		gui.set_text(gui.get_node("x_vel"), message.x_vel)
		gui.set_text(gui.get_node("y_vel"), message.y_vel)
		if (message.grounded == true) then
			gui.set_text(gui.get_node("grounded"), "true")
		else
			gui.set_text(gui.get_node("grounded"), "false")
		end
		if (message.near_up_ladder == true) then
			gui.set_text(gui.get_node("near_up_ladder"), "true")
		else
			gui.set_text(gui.get_node("near_up_ladder"), "false")
		end
		if (message.near_down_ladder == true) then
			gui.set_text(gui.get_node("near_down_ladder"), "true")
		else
			gui.set_text(gui.get_node("near_down_ladder"), "false")
		end
		if (message.jumped == true) then
			gui.set_text(gui.get_node("jumped"),"true")
		else
			gui.set_text(gui.get_node("jumped"), "false")
		end
		if (message.climbing == true) then
			gui.set_text(gui.get_node("climbing"),"true")
		else
			gui.set_text(gui.get_node("climbing"), "false")
		end
		
		if (message.left_pressed == true) then
			gui.set_text(gui.get_node("left_pressed"),"true")
		else
			gui.set_text(gui.get_node("left_pressed"), "false")
		end
		if (message.right_pressed == true) then
			gui.set_text(gui.get_node("right_pressed"),"true")
		else
			gui.set_text(gui.get_node("right_pressed"), "false")
		end
		if (message.up_pressed == true) then
			gui.set_text(gui.get_node("up_pressed"),"true")
		else
			gui.set_text(gui.get_node("up_pressed"), "false")
		end
		if (message.down_pressed == true) then
			gui.set_text(gui.get_node("down_pressed"),"true")
		else
			gui.set_text(gui.get_node("down_pressed"), "false")
		end
		
	end
end

function on_input(self, action_id, action)
	-- Add input-handling code here. The game object this script is attached to
	-- must have acquired input focus:
	--
	--    msg.post(".", "acquire_input_focus")
	--
	-- All mapped input bindings will be received. Mouse and touch input will
	-- be received regardless of where on the screen it happened.
	-- Learn more: https://defold.com/manuals/input/
	-- Remove this function if not needed
end

function on_reload(self)
	-- Add reload-handling code here
	-- Learn more: https://defold.com/manuals/hot-reload/
	-- Remove this function if not needed
end
