insideout-andrew / simple-card-pile-ui

This plugin provides a flexible and customizable card pile user interface for the Godot game engine. It is designed to handle various card-related functionalities including drawing, discarding, and managing different piles.
MIT License
84 stars 9 forks source link

lerp for moving cards #9

Open badjem79 opened 2 months ago

badjem79 commented 2 months ago

I took a look around and as I understood, lerp is not so good for moving objects while easing the position till the target_position as it is frame dependent and not related to delta time

I did a change setting var tween : Tween at the top of CardUI

and changed the part that moves the card in this way: elif position != target_position: if not tween or not tween.is_running(): # moving to target position... tween = get_tree().create_tween() tween.tween_property(self, "position", target_position, return_speed).set_ease(Tween.EASE_OUT) #position = lerp(position, target_position, return_speed)