- The moving ground required some work to correctly adjust its position. It moves a bit backwards and then jump forward.
- The pipes are all drawn from the same two images, one for the top pipes and one for the bottom pipes. The default behavior of the built-in graphic cache is to draw the full image. A delegate class was added and it creates the drawing task with the specific part.
- I've added another ImageView named ivMessages. It is used for the "get ready" and "game over" messages.
- The bird is rotated based on its velocity vector direction:
Really FUN to play with the code. A little frustraiting the collition in the game
It feel betther with a circle Fixture instead of a rectangle in the Create_Bird sub:
B4X:
'Dim rect As B2PolygonShape
'rect.Initialize
Dim size As B2Vec2 = X2.GraphicCache.GetGraphicSizeMeters(wrapper.GraphicName, 0)
'rect.SetAsBox(size.X / 2, size.Y / 2)
'wrapper.Body.CreateFixture2(rect, 0.2)
Dim bShape As B2CircleShape
bShape.Initialize(size.Y / 2)
Dim fix As B2FixtureDef
fix.Shape = bShape
fix.Density = 0.2
wrapper.Body.CreateFixture(fix)
I've uploaded a new version. The GameOver sub is a resumable sub with several steps and sleep periods. This update fixes a bug that happened when the game was paused and resumed during these steps.