Jump to content

Aquaplane - help me understanding waves creation


Recommended Posts

Can you guys that read book "Interphase 1" help me understanding how one can determine that emitter will generate particles in V format (in really a symbol like an "<") that give us the impression of waves behind the boat.

I read and re-read that part of code but I failed to figure it out.

Thank you all.

Note: I don't publish the source code of the game so anyone could answer because I don't think I am allowed to.

Link to comment
Share on other sites

The cause of the < shape is because of these 3 lines:

        this.emitter.gravity = 0;
        this.emitter.setXSpeed(-100, -250);
        this.emitter.setYSpeed(-100, 100);

Gravity 0 stops the particles from falling.

X speed is basically "move left (because the values are negative) at a random speed between 100 and 250". If you remove the minus signs they'll move to the right instead.

Y speed is similar - basically "have a Y velocity between -100 (up) and 100 (down)". The limit on those values, combined with the X speed, is what causes it to emit in a fan shape. Try changing the Y values from +-100 to +-50 and notice the effect - a much narrower fan. Or try +-200 for a wider one. Or try -100, -50, and they'll only move up.

Link to comment
Share on other sites

Soon, I promise. I've been literally snowed under with other tasks, and it took a bit of a back seat. But I've been cranking out the chapters again recently, so am happy with how it's shaping up. Subscribe to the Phaser World newsletter (if you don't already) as I'll announce updates in there.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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