C
CruelBus
Guest
In my game, I have a player vehicle that has tread marks and a particle system assigned to it. When placing all world instances in the regular Draw event, the vehicle is responsible for 4 texture swaps and 4 batches, eventhough the vehicle, tread marks and particle sprite are all on the same texture page. When moving the vehicle to the Draw End event, the texture swaps and batches drop to where they "should be," but the vehicle and its associated tread marks draw on top of everything.
That was my attempt to force some kind of draw order, since everything else is behaving correctly.
Is there a way to carry the depth sorting (depth=-y in my case) from the Draw event to the Draw End event or are these events unique to themselves with everything in the Draw event being drawn on top of everything in the Draw Begin event?
ANSWER: Each draw event (Draw Begin, Draw, Draw End) is handled as its own complete "draw." The result is that everything drawn in the Draw Begin event will be on the bottom. everything in the Draw event will be on top of everything in the Draw Begin event, and finally, everything in the Draw End event will be on top of everything in the first two draw events.
Additional info:
The player vehicle's depth uses the depth=-y method, as does every object in the game except for the terrain and tread marks which have fixed depths.
Moving the tread marks to a different texture page would be counterproductive, since each player vehicle has its own dedicated page in order to minimize texture swaps.
The method I am using for the tread marks is to create an array of 60 instances that cycle in a loop as needed and are drawn with the appropriate image_index, x, y, rotation, color and alpha, (all passed from the vehicle object) and are always drawn at the same depth in world.
That was my attempt to force some kind of draw order, since everything else is behaving correctly.
Is there a way to carry the depth sorting (depth=-y in my case) from the Draw event to the Draw End event or are these events unique to themselves with everything in the Draw event being drawn on top of everything in the Draw Begin event?
ANSWER: Each draw event (Draw Begin, Draw, Draw End) is handled as its own complete "draw." The result is that everything drawn in the Draw Begin event will be on the bottom. everything in the Draw event will be on top of everything in the Draw Begin event, and finally, everything in the Draw End event will be on top of everything in the first two draw events.
Additional info:
The player vehicle's depth uses the depth=-y method, as does every object in the game except for the terrain and tread marks which have fixed depths.
Moving the tread marks to a different texture page would be counterproductive, since each player vehicle has its own dedicated page in order to minimize texture swaps.
The method I am using for the tread marks is to create an array of 60 instances that cycle in a loop as needed and are drawn with the appropriate image_index, x, y, rotation, color and alpha, (all passed from the vehicle object) and are always drawn at the same depth in world.
Last edited by a moderator: