6 – ANIMATION IN LIBGDX INTRO Animation
can very easily be done by using LibGDX.
We simply draw an object based on its coordinates x and y and then
regularly update the values of x and y.
This will be very clear in examples. EXAMPLE 1 – MAKING A
CIRCLE MOVE RIGHT The
code below continuously redraws a circle.
However, that circle’s x coordinate (stored in the variable circleX) is continuously increasing which makes the
circle move. Note
that the coordinates of the circle (circleX and circleY) are data fields. This is necessary for them to store their
values from one call to another.
|
||
|
||
|