i’m making a 2048 game and i made a function that finds what tile to move and where and returns it, i tried to use lerp and timeline in the event graph to achieve the transition animation, but i need to move more than one tile at once, and i can’t use a timeline more than once at the same time, so it only moved one tile every time, how can I set the location of multiple tiles with animation at once?
You could reuse the timeline as many times as there are tiles. An implementation could look like this, for example:
- keep the tiles ToMoveOn in an array (here, Begin Play just adds random tiles for demo purposes - you probably already know which tiles the player will move through - use that instead)
- when the TimeLine plays, move the actor (aMover) between tiles 0 & 1 using TL track + Lerp combo
- when the TL finishes, remove tile 0 (since we moved away from it) and check if at least 2 tiles still remain
- if there are, restart the TL
- if there are not, it means we’ve reached the very last one and the TL can be stopped
This can be improved, of course, but that’s the gist. In motion:
Hope it helps.
1 Like
Another (untested) way could be to use an InterpToMovement component and feed it a set of points; but you’d lose granular control the above solution provides. Simple yet somewhat elegant.