I wanted to have a value continue to increase if the character in the Platformer Tutorial is moving, but this value only increases when the mouse is moving. Below is the code that I used.
function init(self)
local temperature = 87
msg.post(".", "acquire_input_focus")
end
function on_input(self, action_id, action)
if action_id == input_left then
self.moving = true
elseif action_id == input_right then
self.moving = true
elseif action_id == input_jump then
self.moving = true
end
end
function update(self,dt)
if self.moving == true then
local heat = os.clock()
temperature = 87 + heat
local heatnode = gui.get_node("heat")
gui.set_text(heatnode, "Current Frog Temperature(F): " .. temperature )
self.moving = false
end
end