Quantcast
Viewing all articles
Browse latest Browse all 21159

Need a piece of code optimized for my need!

I have 2 arrays. the first array holds the IDs to my sprites and the second array holds the IDs to my objects. and in the main loop, everything is Rendered this way:


Code:

'.....................
For c = 1 To Obj_Count                                                                                  'Loops from the first object to the last

For cc = 1 To Obj_IndexC(c)                    'Each object might have some instances of it's own. loops from the first to the last instance

If Obj_Vis(c, cc) = True And Obj_Removed(c, cc) = False Then          'Check to see if object is visible and it's not removed.

If Obj_Scene(c, cc) = SceneACTV Then                                            'Checks to see if this object belong to this Scene

    If JSprA(Obj_Spr(c)).Seq = 1 Then                                                'See if the current object is marked as animation

  'Each object has an sprite. Obj_Spr(c) holds their sprite ID. Animate and draw object

    JSprA(Obj_Spr(c)).AnimateS Me.hdc, Obj_X(c, cc), Obj_Y(c, cc),

    ElseIf JSprA(Obj_Spr(c)).Seq = 0 Then                                                        'If not an animation

    JSprA(Obj_Spr(c)).TDraw Me.hdc, Obj_X(c, cc), Obj_Y(c, cc), 0, 0, JSprA(Obj_Spr(c)).TransparentColor            'Simply just draw it.

    End If

End If
End If
Next
Next
'.....................


in this piece of code I just loop from the first object to the last and the Draw order is not handled.

Each object has a Obj_ZDepth value which is an array too. I used bubble sort to sort this array but I have no Idea how to associate it with my code in the main loop (above code)

Need help desperately!

Viewing all articles
Browse latest Browse all 21159

Trending Articles