hello I am trying to make a combat system however the attacking animation isn’t completing and therefore won’t trigger the flipbook_done portion, I am confused as to why it will not fully complete
<function play_animation(self, anim)
if self.anim ~= anim then
sprite.play_flipbook("#Player 1", anim, flipbook_done)
self.anim = anim
end
sorry I found the issue it was that in the update function the update_animation function was being called meaning that the animation was being updated every second and not finishing
Just mentioning that this discussion helped me solve a similar problem.
In the War Battles tutorial, when I moved past the initial setup and did the extra suggestions, I had missile-tank explosions not finishing. The missile would hit the tank and then the explosion wouldn’t finish for either the missile or the tank.
Notably, the score would count up like crazy.
Turns out it was the collisions of the tank & missile. They were continuing to happen during the explosion animations and caused the animations to not finish (sort of like the update_animation problem here).
Disabling the collision object on the rocket immediately solved it.
function on_message(self, message_id, message, sender)
if message_id == hash("animation_done") then
go.delete()
elseif message_id == hash("collision_response") then
explode(self)
msg.post("#collisionobject", "disable") -- Disable here ends the collision overloads
msg.post(message.other_id, "explode")
msg.post("/gui#ui", "add_score", {score = 100})
end
end