hello! Its me again im not sure if anyone can help but here is my code:
You can also download the attached project file.
what im trying to do is move the balloon to where the screen was last touched.
Can anyone help me on how will i fix it? the only problem is the logic on how it will move smoothly.
@Erel , @Informatix, @anyone who knows libgdx
B4X:
Sub MovePlayer
If TouchPos.x <> Position.x AND TouchPos.y <> Position.y Then
If TouchPos.x > Position.x Then
'move right
Position.x = (Position.x + 200 * LibGDX.Graphics.DeltaTime)
Else If TouchPos.x < Position.x Then
'move left
Position.x = (Position.x - 200 * LibGDX.Graphics.DeltaTime)
Else
Position.x = TouchPos.x - bgBalloon.Width / 2
TouchPos.x = Position.x
End If
If TouchPos.y > Position.y Then
'move up
Position.y = (Position.y + 200 * LibGDX.Graphics.DeltaTime)
Else If TouchPos.y < Position.y Then
'move down
Position.y = (Position.y - 200 * LibGDX.Graphics.DeltaTime)
Else
Position.y = TouchPos.y - bgBalloon.Height / 2
TouchPos.y = Position.y
End If
End If
End Sub
Sub InputProc_TouchDown(ScreenX As Int, ScreenY As Int, Pointer As Int) As Boolean
'transform x and y location
TouchPos.x = vpWidth * (ScreenX / LibGDX.Graphics.Width)
TouchPos.y = vpHeight - (vpHeight * (ScreenY / LibGDX.Graphics.Height)) 'flip Y coords
Log("TouchPos.x: " & TouchPos.x)
Log("TouchPos.y: " & TouchPos.y)
Return False
End Sub
You can also download the attached project file.
what im trying to do is move the balloon to where the screen was last touched.
Can anyone help me on how will i fix it? the only problem is the logic on how it will move smoothly.
@Erel , @Informatix, @anyone who knows libgdx