Okay, think about it like this: after the unit moves to a square block, you initiate a timer
for that square block (or for the unit, and based on the unit's position you do the animation for the block. Either works.)
The timer goes from 1...0
(if you want it to be 500 ms
, then it would go from 0.5
to 0
, but at the multiplication you will normalize it up to 1
to 0
by multiplying it with 1 / 0.5
which is 2).
When you draw out the block, then if the timer is > 0
, then you draw out a rectangle
using a ShapeRenderer
that begins at the bottom corner
, up to height_of_block * timer
(that goes from 1 to 0
). If your drawing order is background of square block -> yellow rectangle -> unit on top of square block
, then you will have the animation as you update the animation by time
.
To track time
, use the following I wrote down here: How to track time in Libgdx(android)