So im doing something a little weird, where I can the perfect results of a projectile by moving my particle holder itself. the result looks like:
particles = this.add.particles('flares');
emitter = particles.createEmitter({
x: -1000,
y: 100,
angle: { min: 181, max: 179 },
size: {min:1,max: 1},
speed: 400,
gravityY: 0,
scale: { start: 0.4, end: 0 },
lifespan: { min: 1000, max: 2000 },
blendMode: 'ADD',
deathZone: { type: 'onEnter', source: rect }
});
is the emitter
The problem is, because im moving the partciles.x when the particles hit the deathZone rect, they are not killed.
Im not sure the best solution here? trying to move the emitter by using a min and max X with steps, does not provide the right result (plus the particles by default are moving to the left, so they will never hit the deathZone without the global right movement.
Im guessing I could make a custom contains on it, and try to then take the X and Y the emmiter passes and globalize them. But there has to be a better solution?
the end goal is this is a projectile, and when it collides, it looks weird if the trail doesn’t continue into the enemy
=========================
Update
So yeah,
doing a custom hit made it do what I want… but this till feels like a bad way to do this
let test = {
contains: function (x, y) {
console.log(particles.x + x);
if ((particles.x + x) >= 1000) {
return true
}
return false;
}
}