Drawing only specific layers?
Home › Forums › TimelineFX Module › Drawing only specific layers?
- This topic has 3 replies, 2 voices, and was last updated 14 years, 1 month ago by imported_peterigz.
-
AuthorPosts
-
September 29, 2010 at 3:14 am #3185
MongooseParticipantI am trying to work TimelineFX’s particle layering system into my drawing manager, which works on 4 levels (Background, Middle, Foreground, and Overlay) – Below is how my drawing manager works:
CurrentLevel.map.layer = 0
For Local Image:TDraw = EachIn ImageRegList[IR_Back]
Image.Render()
Next
CurrentLevel.Map.Draw (WorldX, WorldY, 0, 0, GraphicsWidth() , GraphicsHeight())
For Local Image:TDraw = EachIn ImageRegList[IR_Mid]
Image.Render()
Next
CurrentLevel.map.layer = 1
CurrentLevel.Map.Draw (WorldX, WorldY, 0, 0, GraphicsWidth() , GraphicsHeight())
CurrentLevel.map.layer = 2
CurrentLevel.Map.Draw (WorldX , WorldY , 0 , 0 , GraphicsWidth() , GraphicsHeight() )
For Local Image:TDraw = EachIn ImageRegList[IR_Fore]
Image.Render()
Next
----> ParticleManager.DrawParticles(Tweener.Tween)
For Local Image:TDraw = EachIn ImageRegList[IR_Overlay]
Image.Render()
NextAs you can notice, the particles are being drawn after the Foreground layer. What i’m aiming to do is according to each layer, and the assigned layers within TimelineFX’s particle manager, allows particles to only spawn on what layer they’re assigned. Layer 0 would be Background, while Layer 2 is Foreground – How would this be achieved? is there a way to make all particle emitters obey this system, since the only place i’ve seen anything on handling layers is within the actual emitters, not the manager.
Thanks for the help!
September 29, 2010 at 4:47 pm #3721
imported_peterigzParticipantHello. To do this what you need to do is create a particle manager for each layer, so you could have Background_PM, Middle_PM, Foreground_PM, and Overlay_PM, and call drawparticles for each one in-between each of your own layers. ie.
CurrentLevel.map.layer = 0
For Local Image:TDraw = EachIn ImageRegList[IR_Back]
Image.Render()
Next
CurrentLevel.Map.Draw (WorldX, WorldY, 0, 0, GraphicsWidth() , GraphicsHeight())
Background_PM.DrawParticles()
For Local Image:TDraw = EachIn ImageRegList[IR_Mid]
Image.Render()
Next
CurrentLevel.map.layer = 1
CurrentLevel.Map.Draw (WorldX, WorldY, 0, 0, GraphicsWidth() , GraphicsHeight())
Middle_PM.DrawParticles()
CurrentLevel.map.layer = 2
CurrentLevel.Map.Draw (WorldX , WorldY , 0 , 0 , GraphicsWidth() , GraphicsHeight() )
For Local Image:TDraw = EachIn ImageRegList[IR_Fore]
Image.Render()
Next
Foreground_PM.DrawParticles()
For Local Image:TDraw = EachIn ImageRegList[IR_Overlay]
Image.Render()
Next
Overlay_PM.DrawParticles()
You can create as many particle managers as you want to organise when you want different particles to be drawn. To see an example in action you can download the vaders game from this site where I think I used 3 different particle managers for this reason.
Hope that helps!
September 30, 2010 at 12:15 am #3722
MongooseParticipantHi Peter,
Is there a way to draw only specific layers within an effect, rather than just spawning whole effects on different particle managers? I noticed particles have a ‘layer’ parameter, or is this merely for Z-sorting within the manager itself? If so, is there a way to pick out which particles are on which layer, and choose which layer you’d like to draw?
For example, in Explosions.eff, there is Mushroom 2 that contains:
Dust – Layer 0
Fire – Layer 0
Collumn – Layer 0
Explosion – Layer 0
Glow1 – Layer 1
Ground Smoke Container – Layer 0Now, say in the case of my drawing manager- You wanted the explosion to be behind the player (On Layer 0, Background – Player occupies Mid ground), but the glow to be in front (Layer 2, Foreground) –
Think this is possible?September 30, 2010 at 4:59 pm #3723
imported_peterigzParticipantI think perhaps the easiest way to do that would be to move the glow into it’s own effect, and add it to the foreground particle manager at the same time as the mushroom effect is added the background particle manager, and it should play in sync fine. So basically, clone the mushroom 2 effect, and delete all emitters except the glow, and then remove the glow from the original effect, and add both effects to 2 particle managers at the same time. Hope that makes sense! š
-
AuthorPosts
You must be logged in to reply to this topic.