I am trying to have animation go to a target, and need the targets position to end the animation.
I tried this, but it only sends the object to the upper left corner, I am pretty sure I am not it's just not getting the x and y position stored correct.
This is resolved I was using the position of image I wanted to move, instead of the target, and imputing the variable back wards (my own stupidity) :BangHead: althought the multiple animation with a single object is not producing the desired effect, think I will got with lines instead
this should be:
I tried this, but it only sends the object to the upper left corner, I am pretty sure I am not it's just not getting the x and y position stored correct.
This is resolved I was using the position of image I wanted to move, instead of the target, and imputing the variable back wards (my own stupidity) :BangHead: althought the multiple animation with a single object is not producing the desired effect, think I will got with lines instead
this should be:
B4X:
tx = imvTarget.Top + 32 '***attempt to store the 'targets' position***
ty = imvTaget.Left + 65 'added the equation to center it
B4X:
Sub Globals
'shots
Dim imvShot1 As ImageView
Dim Button1 As Button
Dim tx, ty As Float
Dim a6, a7, a8, a9 As Animation
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout(1)
a6.InitializeTranslate("Animation", 0, 0, tx/4, ty/4)
a7.InitializeTranslate("Animation", tx/4, ty/4, tx/3, ty/3)
a8.InitializeTranslate("Animation", tx/3, ty/3, tx/2, ty/2)
a9.InitializeTranslate("Animation", tx/2, ty/2, tx, ty)
imvShot1.Tag = a5
animations = Array As Animation(a6, a7, a8, a9)
For i = 0 To animations.Length - 1
animations(i).Duration = 500
Next
End Sub
Sub Fire_Click
Dim b As Button
Fire = Sender
imvShot1.Top = tx '***attempt to store the 'targets' position***
imvShot1.Left = ty
If Not(imvShot1.Tag Is Animation) Then Return
Dim A As Animation
A = imvShot1.Tag
A.Start(imvShot1)
End Sub
Last edited: