Example of a "flappy bird" game. The images and sounds are based on Clumsy Bird open source project: https://github.com/ellisonleao/clumsy-bird (GPL license)
Interesting points:
- 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:
B4X:
bw.Body.SetTransform(bw.Body.Position, ATan2(bw.Body.LinearVelocity.y, bw.Body.LinearVelocity.X))
Example projects included in the examples pack: https://www.b4x.com/android/forum/threads/xui2d-example-pack.96454/
Last edited: