i want:
sprite moving to place,when i press mouse key or tap stylus.
but my algoritm doesnot work
it is my sourse.i'm spend many time for it.sprite move but not correct
help me!:sign0148:
sprite moving to place,when i press mouse key or tap stylus.
but my algoritm doesnot work
it is my sourse.i'm spend many time for it.sprite move but not correct
B4X:
Sub Globals
stop=1
End Sub
Sub App_Start
Sip(false)
game.Show
gamewin.New1("game",0,30,game.Width,game.Height-30)
gamewin.DrawBackgroundImage(AppPath&"\2.jpg")
muxa.New2(AppPath&"\1.bmp",8,16,15,8)
muxa.FrameSpeed=1
muxa.X=0
muxa.Y=100
muxa.Velocity=5
muxa.Direction=90
gamewin.SpriteAdd(muxa.Value)
tanim.Enabled=true
gamewin.Tick
End Sub
Sub tanim_tick
gamewin.Tick
If stop=1 Then tanim.Enabled=false
End Sub
Sub gamewin_NoCollisionMouse
i=Round((ASin(gamewin.X/Sqrt((gamewin.X)^2+(gamewin.Y)^2)))*180/cpi)
l1.Text=gamewin.X&"-"&muxa.X&" "&gamewin.Y&"-"&muxa.y&" "&i
If gamewin.y>muxa.y Then muxa.Direction=90-i
If gamewin.y<muxa.y Then muxa.Direction=i+270
'muxa.Direction=180-i
'muxa.Direction=i
tanim.Enabled=true
stop=0
End Sub
Sub mrefr_Click
stop=1
tanim.Enabled=false
muxa.X=100
muxa.Y=0
gamewin.Tick
End Sub