Hi there. I’m working on a grid based game, and I would like to have a single tween transition for multiple position interpolations Here’s how my movement is working right now :
var queue_movement = []
func move():
for newPos in queue_movement:
var tween = create_tween()
tween.tween_property(self, "global_position", newPos, 0.2)
await tween.finished
The problem with this code is that the movement feels wrong, and I would like to use some transitions (as in tween.set_trans() ).
But, if I do that, the transition will play on each newPos, and not on all of them
for exemple, for 3 positions, here’s what’s it’s doing :
have you tried doing the animation on animation player?
it sounds like what animation player can do, but really tween also can do that by making it into 5 or 3 tween_property.
if 3 tween property():
I have not tried animation player because I don’t know the positions before hand, so tween seemed to me like the correct option
As for your answer, the entities moving on the grid have multiple ways of moving, and that could be for 1,2,3 or X tiles, so I need something that could work in most cases
this just make different tweens/animation walks i think
i see what you meant now, you can actually put function into an array, by using its callable
then just .pick_random() from the array for each movement, and .call() it to execute the function chosen
each different functions has different ease and trans
it will be complicated on how you gonna wait for each tween to be finished, i havent tested await from callable function. for now you can wait exactly 0.2 seconds for each function called by its callable