GameView Update problem

sterlingy

Active Member
Licensed User
Longtime User
In my app, a game, when the hero character is killed, I want to scroll the back to the starting position. What happens is that it jumps back.

I use a loop, but it seems that the GameView does not update until the loop finishes.

Any idea what I might be doing wrong?

B4X:
Log("startLocY: " & startLocY)
Log("CenterY: " & game.streetBackground.SrcRect.CenterY)
      Do While game.streetBackground.SrcRect.CenterY <> startLocY
         If game.streetBackground.SrcRect.CenterY > startLocY Then
            game.streetBackground.SrcRect.top = game.streetBackground.SrcRect.top -  1 '4dip ' Mod (game.streetBackground.Bitmap.Height - 62%y / game.backgroundScale)
            game.streetBackground.SrcRect.Bottom = game.streetBackground.SrcRect.top + 62%y / game.backgroundScale  + 1
         Else
            game.streetBackground.SrcRect.top = game.streetBackground.SrcRect.top + 1 '4dip ' Mod (game.streetBackground.Bitmap.Height - 62%y / game.backgroundScale)
            game.streetBackground.SrcRect.Bottom = game.streetBackground.SrcRect.top + 62%y / game.backgroundScale  + 1
         End If
         pauseInterval = pauseInterval + 1

Log("scrY" & game.streetBackground.SrcRect.CenterY )
 game.gv.Invalidate
 

sterlingy

Active Member
Licensed User
Longtime User
This is what I was afraid of. Now I have to figure out how to make that happen.

When my Hero character dies, I want to scroll the screen back to the starting position and it's currently happening in another module. I'm sure I'll figure it out.

-Sterling
 
Upvote 0
Top