Sorry for my arrogance before, but I am under too much stress these days.
I have now tried the script directly (I didn't before, I had only read the code).
After "cleaning" the code a bit, it works, so I confirm that there is no bug (unless someone can prove that I am wrong

).
The problem is just that the script is not well coded, in the following parts:
I tested it with a custom_entity script. There is a line of code missing since "metatable_entity" is not defined, but I guess that it is
metatable_entity = ...
and in that case "metatable_entity" is not really a metatable in the formal sense (I think).
1) Your events on_interaction() and on_movement_changed() are not called the first time you create a jump, because they are defined inside your function "metatable_entity:jump". These events should be defined outside that function. Although the variable quick_movement is not defined outside the function "jump", you can still access the movement with entity:get_movement().
2) This part is really confusing and gives problems:
sol.timer.start(450, function()
function quick_movement:on_finished()
set_stop_aniamtion = true
end
if set_stop_aniamtion == true then
sol.audio.play_sound(finish_jump_sound)
self:get_sprite():set_animation(finish_animation) --finish_animation
return false
end
return true
end)
If your jump ends in less than 450 ms, the event quick_movement:on_finished() would never be called since it would be defined after the movement has ended. Actually you do not need a timer, and should probably write something like this instead of the above code:
function quick_movement:on_finished()
sol.audio.play_sound(finish_jump_sound)
entity:get_sprite():set_animation(finish_animation)
end
I can paste a copy of the modified script if you want. It works and the sprite of the custom entity is always facing the direction of the jump, which I believe is what you wanted (otherwise I did not understand your final purpose).
And I insist that having a clean code is more important that it may appear, not only for finding bugs, but also to make the code understandable to others who want to help you.