CyclopDroid Well-Known Member Licensed User Longtime User Feb 22, 2016 #1 My game runs normally on smartphones but, on TV, suddenly it ends randomly. I have no error and no warning ... but, on TV, it continues to exit the game in different moments. It happened to any of you? How to fix it?
My game runs normally on smartphones but, on TV, suddenly it ends randomly. I have no error and no warning ... but, on TV, it continues to exit the game in different moments. It happened to any of you? How to fix it?
CyclopDroid Well-Known Member Licensed User Longtime User Feb 25, 2016 #21 FIND the problem The cause of the end was due to the timer which had entered into my game. Es: B4X: Sub Man_Click() If pnlMenu.Visible=True Then Pause(1) pnlMenu.Visible=False '... ... ... End Sub B4X: Private Sub Pause(Secondi As Int) Dim Ti As Long Ti = DateTime.Now + (Secondi * 1000) Do While DateTime.Now < Ti DoEvents Loop End Sub Upvote 0
FIND the problem The cause of the end was due to the timer which had entered into my game. Es: B4X: Sub Man_Click() If pnlMenu.Visible=True Then Pause(1) pnlMenu.Visible=False '... ... ... End Sub B4X: Private Sub Pause(Secondi As Int) Dim Ti As Long Ti = DateTime.Now + (Secondi * 1000) Do While DateTime.Now < Ti DoEvents Loop End Sub
Erel B4X founder Staff member Licensed User Longtime User Feb 25, 2016 #22 You should never try to hold the main thread. Nothing good will come out of this. Upvote 0
CyclopDroid Well-Known Member Licensed User Longtime User Feb 25, 2016 #23 See this problem. I'e change the Sub Pause(Secondi As Int) with a Timer_tick but the image not mouve up the screen...it's appears immediatly. B4X: For k=100%y To 0%y Step -10%y secondi=.1 Attendi2.Enabled=True imgsceriffo.Top=k imgfacesc.Top=k Next B4X: Sub Attendi2_tick If millesimi>=secondi Then Attendi2.enabled=False millesimi=0 Else millesimi=millesimi+.1 End If End Sub Where am I wrong? After the tick, not retuen in the For-Next loop? Upvote 0
See this problem. I'e change the Sub Pause(Secondi As Int) with a Timer_tick but the image not mouve up the screen...it's appears immediatly. B4X: For k=100%y To 0%y Step -10%y secondi=.1 Attendi2.Enabled=True imgsceriffo.Top=k imgfacesc.Top=k Next B4X: Sub Attendi2_tick If millesimi>=secondi Then Attendi2.enabled=False millesimi=0 Else millesimi=millesimi+.1 End If End Sub Where am I wrong? After the tick, not retuen in the For-Next loop?
LucaMs Expert Licensed User Longtime User Feb 25, 2016 #24 First of all you could use one of the animation libraries. Otherwise you should use a timer and every tick decrease the value of y, using a global variable. Another option, which Erel loves , is: Activity.Invalidate : DoEvents after imgfacesc.top = k Last edited: Feb 25, 2016 Upvote 0
First of all you could use one of the animation libraries. Otherwise you should use a timer and every tick decrease the value of y, using a global variable. Another option, which Erel loves , is: Activity.Invalidate : DoEvents after imgfacesc.top = k
LucaMs Expert Licensed User Longtime User Feb 25, 2016 #25 LucaMs said: First of all you could use one of the animation libraries. Click to expand... Attachments SceriffoAnim.zip 34.4 KB · Views: 261 Upvote 0