Jump to content

spaceship thrust physics


cubiq
 Share

Recommended Posts

I have a game with an "asteroid-like" view. I'm fighting with the particle system to build a believable engine thrust but I'm failing miserably.

 

I've seen the sci fly example and a demo on codepen. Basically you either link the emitter to the sprite or update the emitter position in the update phase. I have no problems making the particles work, but it's hard to make it "believable".

 

The issues I'm encountering are:

 

1) The direction/gravity of the thrust should always be opposite to the spaceship direction, but particles should not follow the spaceship once emitted. Meaning that attaching the emitter to the sprite is a no-no, unless I'm missing something.

 

2) The particles should have some sort of "friction", so when the spaceship turns the particles form a nice arc

 

3) When the burst is off, the particles shouldn't stop right away but extinguish slowly. I was thinking to add a tween to the emitter Y, unless there's a simpler way.

 

Any guidance would be greatly appreciated.

 

PS: is there a phaser particle system editor/previewer somewhere?

Link to comment
Share on other sites

I come to the conclusion that it can't be done with the phaser's particle system. I had to create my little tiny particle system and make the engine thrust act very close to a "trail". The result is rendered on a render texture, so I guess it should be pretty fast.

 

I will eventually post the source code.

Link to comment
Share on other sites

Particles in Phaser do not follow their emitter, so moving the emitter to the position of the ship every frame shouldn't have been a problem.

 

(See this example: http://examples.phaser.io/_site/view_full.html?d=particles&f=click+burst.js&t=click%20burst)

 

Click twice at different screen position. (The emitter is moved to the second position - this does not impact the particle positions of the first emission)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...