Games Angry Birds Example

Discussion in 'Game Development' started by Gunther, Nov 6, 2018.

  1. Gunther

    Gunther Active Member Licensed User

    Why you used two different approaches to the set a drawtask in Angry Birds Example:

    Code:
    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"?
     
  2. Erel

    Erel Administrator Staff Member Licensed 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:

    [​IMG]

    '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.
     
    jmon and Gunther like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice