Android Question move object from one point to another...

ilan

Expert
Licensed User
Longtime User
hi

i am trying to move a pic (missle) from one point in my activity to another but its not working

i want to move it from the point its is to the point i press in the activity

B4X:
Sub Gesture_onSingleTapConfirmed(X As Float, Y As Float, MotionEvent As Object)
    'Log("  onSingleTapConfirmed x = " & X & ", y = " & Y & ", ev = " & MotionEvent)
    'ToastMessageShow("Single-Tap" & "x = " & X & ", y = " & Y, False)
   
    tox = X - (mainpanel.Width / 2)
    toy = Y - (mainpanel.Height / 2)
   
   
    missle1.Top = sheep.Top  - missle1.Height - 10dip
    missle1.Left = (mainpanel.Width / 2) - (missle1.Width / 2)
   
    misslemp.Load(File.DirAssets,"shoot.mp3")
    misslemp.Play

    missle1.Visible = True
    missle1.BringToFront
   
    a1.InitializeTranslate("a1", 0 ,0 ,tox,toy) 'here i try to move the missle
    a1.Duration = 2000
    a1.Start(missle1)
   
End Sub

what am i doing wrong??

thank you guys
 
Top