> function init(self)
> msg.post(".", "acquire_input_focus")
> self.vel = vmath.vector3()
> end
>
> function update(self, dt)
> local pos = go.get_position()
> pos = pos + (self.vel * dt)
> go.set_position(pos)
> self.vel.x = 0
> end
>
> function on_input(self, action_id, action)
>
> if action_id == hash("right") then
> self.vel.x= 150
> sprite.play_flipbook("#sprite", "walk")
> elseif action_id == hash("left") then
> self.vel.x= -150
> sprite.play_flipbook("#sprite", "walk")
> end
> if action_id == hash("right") and action.released then
> self.vel.x= 150
> sprite.play_flipbook("#sprite", "idle")
> elseif action_id == hash("left") and action. released then
> self.vel.x= -150
> sprite.play_flipbook("#sprite", "idle")
> end
> end
This is my code for my character moving. However. whenever I press right or left arrow, the character moves, but does not play “walk” flipbook animation. what is the error?