Sign in to follow this  

click burst example and emmiter gravity

Recommended Posts

So I'm brand new to Phaser 

I decided to try the click burst example as a tutorial

I'm on MS Windows  I have the latest Chrome browser.

I download phaser.js and phaser.min.js from here (this is the 2.7.6 version)

I downloaded the  Mongoose web server as recommended here 

I copied the code from the click burst example and put it inside a web page named index.html 

I started Mongoose and navigated to index.html (which is local on my D: drive)

The page opened. I could see color and if I clicked on the page a diamond showed up. Then another diamond, and another and another... 

But, the diamonds weren't being a "fountain" of diamonds. They were showing up directly under each other and not moving.

Every time I clicked I got a new emitter in the clicked position, but the diamonds weren't moving.  

I did a google search for relevant terms and only found the mention of emitter explode being better than emitter start.

Finally found the API  and saw that gravity is a Phaser point.

Which led me to line 121 of  emitter.js 

The example set gravity with 
emitter.gravity = 200; 

but line 121 sets gravity with 
this.gravity = new Phaser.Point(0, 100);

The line in the example does not look like a point to me (its only one number). So I changed the code in my html file to set gravity the same way line 121 does (by making a new point and assigning it to gravity). 
emitter.gravity = new Phaser.Point(0, 100);

I reloaded my web page in mongoose and now the emitter works as expected. 

what am I missing ? What am I not understanding ? 

Is the example incorrect ? Why does the example work on the phaser website, but now on my computer ? 
Is there some really stupid mistake in my code ? 
emitter.gravity = 100;  
a shortcut for 
emitter.gravity = new Phaser.Point(0, 100); 

Oh, I'm also a total noob to javascript.
I'm an expert in MS Excel and VBA and beginner / intermediate in R so I know some programming.

Thanks for the help


Share this post

Link to post
Share on other sites

Emitter#gravity changed to a Phaser.Point in Phaser CE 2.7.2. Unfortunately that change wasn't backwards-compatible so it's been confusing.

The particle examples are written for Phaser <= 2.6.2 when gravity was a number.

With Phaser >= 2.7.2 you can use

emitter.gravity.y = 100;


emitter.gravity.setTo(0, 100);

or `new Phaser.Point` like yours. 

Share this post

Link to post
Share on other sites


that explains a lot 

is there a place where all these changes are listed 

I see this page 

and read the Change Log there 
but it it only has the most recent changes --- so the gravity change isn't mentioned 

It does have this line 
For changes in previous releases please see the extensive Version History

But the link leads me to a 404 page


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.