Public Sub Tick (GS As X2GameStep)
If X2.RndFloat(0, 1000) < X2.TimeStepMs Then CreateBlock
If X2.RndFloat(0, 1000) < X2.TimeStepMs Then CreateCircle
'draw circles
For Each body As B2Body In X2.mWorld.AllBodies
Dim bw As X2BodyWrapper = body.Tag
If bw.DelegateTo Is StubBody Then
'only circles
If bw.Tag = True Then
DrawBody(bw, GS)
End If
End If
Next
'draw blocks
For Each body As B2Body In X2.mWorld.AllBodies
Dim bw As X2BodyWrapper = body.Tag
If bw.DelegateTo Is StubBody Then
'only blocks
If bw.Tag = False Then
DrawBody(bw, GS)
End If
End If
Next
End Sub
Private Sub DrawBody(bw As X2BodyWrapper, gs As X2GameStep)
'code from X2BodyWrapper
If (bw.TimeToLiveMs > 0 And (gs.GameTimeMs - bw.StartTime) >= bw.TimeToLiveMs) Then
bw.Delete(gs)
Return
End If
If bw.GraphicName <> "" Then bw.UpdateGraphic (gs, True)
End Sub