|
@@ -4,7 +4,7 @@ function init(self)
|
|
|
end
|
|
|
|
|
|
local function landed(self) -- <9>
|
|
|
- self.moving = false
|
|
|
+ self.moving = false
|
|
|
end
|
|
|
|
|
|
function on_input(self, action_id, action)
|
|
@@ -14,13 +14,13 @@ function on_input(self, action_id, action)
|
|
|
self.moving = true -- <6>
|
|
|
pos = vmath.vector3(action.x, action.y, 0) -- <7>
|
|
|
go.animate(".", "position", go.PLAYBACK_ONCE_FORWARD, pos, go.EASING_LINEAR, 0.5, 0, landed) -- <8>
|
|
|
- end
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
|
|
|
--[[
|
|
|
1. Tell the engine that this game object ("." is shorthand for the current game object) should listen to input. Any input will be received in the `on_input()` function.
|
|
|
-2. Store a flag in `self` (the current script component) to indicate if the game object is moving or nit.
|
|
|
+2. Store a flag in `self` (the current script component) to indicate if the game object is moving or not.
|
|
|
3. If we receive an input action named "click" and it is pressed then run the following.
|
|
|
4. If the `moving` flag is not set.
|
|
|
5. Disable (don't show) the help text label.
|
|
@@ -30,4 +30,4 @@ end
|
|
|
When the animation is done, call the function `landed()`.
|
|
|
9. The function `landed()` is called when the animation is done. It just resets the `moving` flag
|
|
|
so subsequent clicks will result in a new movement.
|
|
|
---]]
|
|
|
+--]]
|