How to: Spawn particles in a random area that always move away from center.
Something i just tried out today that unexpectedly worked.
so
-create 2 real attributes-
emitterx
emittery
-create a timer with the following two behaviors-
every 0 seconds
change emitterx to random(-100,100)
change emittery to random(-100,100)
-add a particles behavior-
-under the velocity/position tab set the emitter offset to-
self.emitterx -- in the first block
self.emitterty -- in the second block
-set the direction to-
vectorToAngle((self.position.x+self.emitterx)-self.position.x,(self.position.y+self.emittery)-self.position.y)
now your particles will spawn inside a 200x200 area centered around the center of your actor but will always move away from the center.
Enjoy.
so
-create 2 real attributes-
emitterx
emittery
-create a timer with the following two behaviors-
every 0 seconds
change emitterx to random(-100,100)
change emittery to random(-100,100)
-add a particles behavior-
-under the velocity/position tab set the emitter offset to-
self.emitterx -- in the first block
self.emitterty -- in the second block
-set the direction to-
vectorToAngle((self.position.x+self.emitterx)-self.position.x,(self.position.y+self.emittery)-self.position.y)
now your particles will spawn inside a 200x200 area centered around the center of your actor but will always move away from the center.
Enjoy.
Comments
did it with several particles in various colors! and nice exciting effects!
Thanx!
@};- MH
i was pretty happy when it worked, i didn't really didn't think that it would.
Also, after playing around a little bit more, you can change the point that the particles move away from (making this much more versatile)
in direction
vectorToAngle((self.positionx+self.emitterx)-(self.position.x+100),(self.position.y+self.emittery)-(self.position.y+100))
if you do that you will end up with the particles being spawned randomly in a 200x200 area that are moving away from the top right corner of that area.
so... you can spawn particles randomly in an area of any size and have the particles move away from any point on the scene.
that ought to provide for some cool particle effects for people.