local utils = require "scripts.utils" function init(self) msg.post(".", "acquire_input_focus") 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 fixed_update(self, dt) -- This function is called if 'Fixed Update Frequency' is enabled in the Engine section of game.project -- Can be coupled with fixed updates of the physics simulation if 'Use Fixed Timestep' is enabled in -- Physics section of game.project -- 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) -- Add message-handling code here -- Learn more: https://defold.com/manuals/message-passing/ -- Remove this function if not needed end function on_input(self, action_id, action) if action_id == hash("touch") and action.pressed then self.next_state = "moving" local tx, ty, _ = utils.screen_to_world(action.screen_x, action.screen_y, 0, "/CameraParent#camera") self.target_pos = vmath.vector3(tx, ty, 0) elseif action_id == hash("right-click") then -- msg.post(receiver, message_id, message) end end function on_reload(self) msg.post(".", "acquire_input_focus") -- Add reload-handling code here -- Learn more: https://defold.com/manuals/hot-reload/ -- Remove this function if not needed end