Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

I've been messing around both with depth sorting and with the particle system (and presets). I have the depth sorting exactly how I want it with the engine and objects (depth= -room_height-bbox_bottom). however, I'm unsure how to modify the depth of the particles. I see that you have set_depth in the le_particles object, but when I attempt to use this function, it does not change the depth. The particles always appear below everything else no matter what I put in there. Any ideas of a work around?

Try setting the "shadow_depth" variable on the particle system object.  It is normalized 0 - 1 as well. 

It uses both the instance "depth" variable and that.  One is for just the basic draw order (depth sorted) and the other is how it is lit.  If that doesn't work let me know. 

By "particle system object" do you mean _le_particles? I've been using the presets provided in the example project. The shadow_depth was already set to 1 which I presume would make it appear above other things. 

I'm using the preset _le_light_fire (that is using a function to create the particles)., which has _light_cull as parent. There is no shadow_depth for this object, but I want to have the depth of this object determine the depth of the particles. Is that possible? 

That fire effect is a light and uses the particle system combined. So, you would set the light depth of the object, and the depth of the particle system.

Deleted 1 year ago

I watched your tutorial on normalized depth sorting, and decided to change my depth according to it. So now all my objects have positive depth with depth = room_height - bbox_bottom + 100 (except for lighting engine which is -100). 

If I set depth of le_light_fire to -1 and part_system_depth(particle_system,-1), it does not draw the particles over the ordinary objects with positive depth.

I also tried a depth that is BELOW the lighting system itself (-100) just as a test. If I set the depth of le_light_fire to -200 and part_system_depth(particle_system,-200), it does not draw the particles over the ordinary objects with positive depth.

Ah, I was looking through things and it is the regular instance variable depth that needs changed along with the particle system.

I have it setup to use layers which work well for drawing over things.  

I'll modify things for the next update, and until then set the instance "depth" variable in the effects object as you would any instance.

Yep. That fixed it.  Also, you don't have to change the depth of the particle system or the le_light_fire, just the le_effects object.

Only problem with this set up is now all of my particle effects depth are determined by a single abstract object that may need different depths depending on what is using it to make the particle effects.

It's possible to make multiple particle objects and put them on different layers.  That would require keeping track of their id of course.

Now that static variables are really easy to use I might try to add another setup I use for "depth" based particles.  Basically it's a static array of particle systems that gets cycled through and the depth changes.

It's just annoying that entire particle systems in GM are assigned a single depth or layer.


I would be interested in trying out the static array method, since I've mostly done away with layers and moved to the depth sorting you propose in your tutorial. 

There really should be an easier way to do all of this. GM is supposed to be an easy engine to develop on, but some things....