Hi, does anyone know how to do blood splash?
-
I'm trying to do this effect, so I do some research in the Demo "Mode", it uses the FlxEmitter to implement the explode, but I don't think the behavior of these particles is suitable for blood splashing, because the particles will sliding all a way through the ground when they collide with the floor or the wall.
I tried change the following code:
_littleGibs.velocity.set( -150, -200, 150, 0); _littleGibs.angularVelocity.set( -720); _littleGibs.acceleration.set(0, 350);
It still seems that there is no change in this "sliding" behavior.
so, I don't know how to implement the blood splash with FlxEmitter , and have no clue with other solution for this, can anyone give some tips?I hope I can get some suggestions. thx :)
-
Is it that you want the particles to collide with the tilemap? If so, you can add
_littleGibs.allowCollisions = FlxObject.ANY;
EDIT: forgot to say that you'll also need to add
FlxG.collide(_littleGibs, yourTilemap);
toupdate()
-
This post is deleted!
-
@dean yeah thx for reply, but my emitter is already setup the particles for collision by this:
flxEmitterObj.solid = true;
, I mean I wish the particles will stop moving anymore after they hit the floor or wall, but I don't know how to do that with FlxEmitter, because as in the DEMO, when the particles falls to the ground, they still "sliding" for a while.(sorry , my English is really bad)
-
@nullstack
oh, ok. try_littleGibs.elasticity.set(0.5, 0.5, 0)
to controll that. Try different values to make it how you want._littleGibs.elasticity.set(0);
will remove elasticity altogether. your English is fine :)
-
FYI, there are 2
launchMode
s:FlxEmitterMode.CIRCLE
(default, if you don't specify the launchMode)
FlxEmitterMode.SQUARE
and some settings are only used depending on the launchMode. So in your code ^ the
velocity.set()
is ignored because it only is used when launchMode = FlxEmitterMode.SQUARE. There's a note in the API and autocomplete.
-
@dean haha thx a lot, actually the translator help me a lot, okay I try change the launchMode to SQUARE and do a little tweek in
velocity.set()
, but the behavior still going, maybe I can mail you the .exe file for details, I think the important problem is I don't know what eachFlxPointRangeBounds.set()
's argument means :(
-
@dean oh btw, maybe its because my Math as bad as my English QAQ
-
@nullstack
You don't need to use SQUARE, just wanted to point out that there are 2 launchModes.Depending on your editor (I use vscode) you can hover the mouse over
set
and it shows the function arguments and meanings. Emitters take some tweaking and can be tricky to get them to do what you want, but you will get it after some trial and error.
-
@dean ok I'll go back and try more, thanks a lot bro :D
-
@nullstack
Here's one I use but it's just a quick one that doesn't collide with the tilemap. Maybe it will help.var _blood = new FlxEmitter().loadParticles(new FlxSprite().makeGraphic(1, 3, 0xFFFF0000).graphic, 50); _blood.launchAngle.set(-135, -45); _blood.speed.set(120, 240); _blood.acceleration.set(0, 300, 0, 480); _blood.lifespan.set(1);