æ Çfunction init(self) msg.post("#sprite", "disable") self.player_direction = "right" self.visible = false end function update(self, dt) local player_pos = go.get_position("player") if self.player_direction == "right" then local offset = vmath.vector3(30, -8, 0) go.set_position(player_pos + offset) elseif self.player_direction == "left" then local offset = vmath.vector3(-30, -8, 0) go.set_position(player_pos + offset) end end function on_message(self, message_id, message, sender) if message_id == hash("enable_sprite") then msg.post("#sprite", "enable") self.visible = true end if message_id == hash("testing_amulet") then print("testing_amulet") msg.post(sender, "testing_amulet_response", {visible = self.visible}) end if message_id == hash("right") then self.player_direction = "right" end if message_id == hash("left") then self.player_direction = "left" end if message_id == hash("disable_sprite") then msg.post("#sprite", "disable") self.visible = false end end @main/holdingamulet.script"