Hey Walter!!
Sure, I'll be glad to share how I did it.
For this example, consider an object that starts hidden off screen at -10%y which will slide down to its target position of 15%y.
First let's set the object size (
Width and
Height), its
initial position x,y and its
target position x,y.
The initial position is the off screen position, the target position will be, well, your target position.
'In the Sub Globals...
Dim OBJECT_H = 8%y As Float
Dim OBJECT_W = (OBJECT_H * 228) / 59 As Float
Dim OBJECT_iX = 50%x - (OBJECT_W / 2) As Float
Dim OBJECT_iY = -10%y - (OBJECT_H / 2) As Float
Dim OBJECT_tX = 50%x - (OBJECT_W / 2) As Float
Dim OBJECT_tY = 15%y - (OBJECT_H / 2) As Float
Dim OBJECT_X = OBJECT_iX As Float
Dim OBJECT_Y = OBJECT_iY As Float
Now let's create the "Sliders" where
66%y is my arbitrary speed and
lgdx.graphics.DeltaTime is the step.
Sub Hide_OBJECT
If OBJECT_Y > OBJECT_iY Then
OBJECT_Y = OBJECT_Y - 66%y * lgdx.graphics.DeltaTime
Else
OBJECT_Y = OBJECT_iY
End If
End Sub
Sub Show_OBJECT
If OBJECT_Y < OBJECT_tY Then
OBJECT_Y = OBJECT_Y + 66%y * lgdx.graphics.DeltaTime
Else
OBJECT_Y = OBJECT_tY
End If
End Sub
All we have to do now is call the subroutines as needed in a (the) main cycle, for example Sub LG_RENDER
'In Sub LG_Render...
Batch.Begin
If This_OBJECT_Should_Be_Visible = True Then
Show_OBJECT
Else
Hide_OBJECT
End If
Batch.DrawRegion2(OBJECT, OBJECT_X, OBJECT_Y, OBJECT_W, OBJECT_H)
Batch.End
I hope this helps, as you can see, it's pretty simple.