Hi there!
I will be adding a lot to it over the course of Sunday-Monday so watch for updates . I will also be making a separate post about it later -- let me know if you think there should be different ways of doing things.
First I have to say: Good structured souce code, mate!
At the moment you use CircleShape for the smoke effect. Some plans to integrate texture effects?
I will have a deeper look later.
Thanks
You can use whatever you like
. All you gotta do is change CircleShape to a Sprite -- UserObject gets passed around per-particle and eventually gets cast into a Drawable and drawn to screen.
So basically, you could have ANY object that inherits from Drawable as UserObject and it will get drawn however you set it up and refresh the object.
For example -- I am making a fire work example particle effect; this is what I do:
public RocketEmitter
() : base(1,
2) { ParticleInitialization
= SmokeParticleInit
; OnEveryUpdate
+= PresetAffectors
.UpdatePositionBasedOnRotationAndVelocity; OnRefreshUserObject
+= RefreshUserObject
; Texture texture
= new Texture
(@"Assets\rocket_triangle.png"); OnParticleCreated
+= particle
=> { Sprite sprite
= new Sprite
(texture
) {Origin
= new Vector2f
(20,
24), Scale
= new Vector2f
(.25f,
.25f
)}; particle
.UserObject = sprite
; }; } And then I have this:
private void RefreshUserObject
(Particle particle
) { Sprite shape
= (Sprite
)particle
.UserObject; shape
.Position = new Vector2f
(particle
.Position.X, particle
.Position.Y); shape
.Color = new Color
(0,
0,
0,
(byte)particle
.Alpha); shape
.Rotation = particle
.Rotation; } And then it draws rocket sprites on screen
The smoke effect isn't quite done yet -- I will have something better committed soon