Games Angry Birds Example


Active Member
Licensed User
Longtime User
Why you used two different approaches to the set a drawtask in Angry Birds Example:

Private Sub DrawRopes (gs As X2GameStep, angle As Float)
gs.DrawingTasks.Add(X2.MainBC.AsyncDrawLine(bcpoint.X, bcpoint.Y, HookPointLeft.X, HookPointLeft.Y, PulleyBrush, 5))
X2.LastDrawingTasks.Add(X2.MainBC.AsyncDrawLine(bcpoint.X, bcpoint.Y, HookPointRight.X, HookPointRight.Y, PulleyBrush, 5))

What is the reson behind not adding a second "gs.DrawingTasks.Add"?


B4X founder
Staff member
Licensed User
Longtime User
Good question.

1. We want one of the lines to appear behind the bird and the other in front of it.
2. Game.Tick is called before all other bodies are drawn.
3. The tasks in X2.LastDrawingTasks are drawn after the tasks in gs.DrawingTasks.

I hope that it is clear.

Note that there are two related properties that you can set in tiled:


'draw first' means that the body task will be inserted at the beginning of gs.DrawingTasks (after the very first task which is the task that clears everything).
'draw last' means that the body task will be added to X2.LastDrawingTasks.