mirror of
https://github.com/photonstorm/phaser
synced 2024-11-25 22:20:44 +00:00
Added new Contributors guide.
This commit is contained in:
parent
038bca11b2
commit
67e2caafbc
5 changed files with 169 additions and 47 deletions
72
CONTRIBUTING.md
Normal file
72
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
#How to contribute
|
||||||
|
|
||||||
|
It's important to us that you feel you can contribute towards the evolution of Phaser. This can take many forms: from helping to fix bugs or improve the docs, to adding in new features to the source. This guide should help you in making that process as smooth as possible.
|
||||||
|
|
||||||
|
|
||||||
|
##Reporting issues
|
||||||
|
|
||||||
|
[GitHub Issues][0] is the place to report bugs you may have found in either the core library or any of the examples that are part of the repository. When submitting a bug please do the following:
|
||||||
|
|
||||||
|
1. **Search for existing issues.** Your bug may have already been fixed or addressed in a development branch version of Phaser, so be sure to search the issues first before putting in a duplicate issue.
|
||||||
|
|
||||||
|
2. **Create an isolated and reproducible test case.** If you are reporting a bug, make sure you also have a minimal, runnable, code example that reproduces the problem you have.
|
||||||
|
|
||||||
|
3. **Include a live example.** After narrowing your code down to only the problem areas, make use of[jsFiddle][1], [jsBin][2], or a link to your live site so that we can view a live example of the problem.
|
||||||
|
|
||||||
|
4. **Share as much information as possible.** Include browser version affected, your OS, version of the library, steps to reproduce, etc. "X isn't working!!!1!" will probably just be closed.
|
||||||
|
|
||||||
|
|
||||||
|
##Pixi and Phaser
|
||||||
|
|
||||||
|
It's important to understand that internally Phaser uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) for all rendering. It's possible you may find a bug that is generated on the Pixi level rather than Phaser. You're welcome to still report the issue of course, but if you get a reply saying we think it might be a Pixi issue this is what we're talking about :)
|
||||||
|
|
||||||
|
|
||||||
|
##Support Forum
|
||||||
|
|
||||||
|
We have a very active [Phaser Support Forum](http://www.html5gamedevs.com/forum/14-phaser/). If you need general support, or are struggling to understand how to do something or need your code checked over, then we would urge you to post it to our forum. There are a lot of friendly devs in there who can help, as well as the core Phaser and Pixi teams, so it's a great place to get support from. You're welcome to report bugs directly on GitHub, but for general support we'd always recommend using the forum first.
|
||||||
|
|
||||||
|
|
||||||
|
##Dev vs. Master
|
||||||
|
|
||||||
|
The dev branch of Phaser is our 'current working' version. It is always ahead of the master branch in terms of features and fixes. However it's also bleeding-edge and experimental and we cannot and do not guarantee it will compile or work for you. Very often we have to break things for a few days while we rebuild and patch. So by all means please export the dev branch and contribute towards it, indeed that is where all Pull Requests should be sent, but do so understanding the API may change beneath you.
|
||||||
|
|
||||||
|
|
||||||
|
##Making Changes
|
||||||
|
|
||||||
|
To take advantage of our grunt build script and jshint config it will be easiest for you if you have node.js and grunt installed locally.
|
||||||
|
|
||||||
|
You can download node.js from[nodejs.org][3]. After it has been installed open a console and run `npm i - g grunt - cli` to install the global `grunt` executable.
|
||||||
|
|
||||||
|
After that you can clone the repository and run `npm i` inside the cloned folder. This will install dependencies necessary for building the project. Once that is ready,
|
||||||
|
make your changes and submit a Pull Request:
|
||||||
|
|
||||||
|
- **Send Pull Requests to the `dev` branch.** All Pull Requests must be sent to the `dev` branch, `master` is the latest release and PRs to that branch will be closed.
|
||||||
|
|
||||||
|
- **Ensure changes are jshint validated.** Our JSHint configuration file is provided in the repository and you should check against it before submitting.
|
||||||
|
|
||||||
|
- **Never commit new builds.** When making a code change you should always run `grunt` which will rebuild the project so you can test, *however* please do not commit these new builds or your PR will be closed. Builds by default are placed in the `dist` folder, to keep them separate from the `build` folder releases.
|
||||||
|
|
||||||
|
- **Only commit relevant changes.** Don't include changes that are not directly relevant to the fix you are making. The more focused a PR is, the faster it will get attention and be merged. Extra files changing only whitespace or trash files will likely get your PR closed.
|
||||||
|
|
||||||
|
|
||||||
|
##I don't really like git / node.js, but I can fix this bug
|
||||||
|
|
||||||
|
That is fine too. While Pull Requests are the best thing in the world for us, they are not the only way to help. You're welcome to post fixes to our forum or even just email them to us. All we ask is that you still adhere to the guidelines presented here re: JSHint, etc.
|
||||||
|
|
||||||
|
|
||||||
|
##Code Style Guide
|
||||||
|
|
||||||
|
- Use 4 spaces for tabs, never tab characters.
|
||||||
|
|
||||||
|
- No trailing whitespace, blank lines should have no whitespace.
|
||||||
|
|
||||||
|
- Always favor strict equals` === `unless you * need * to use type coercion.
|
||||||
|
|
||||||
|
- Follow conventions already in the code, and listen to jshint. Our config is set-up for a reason.
|
||||||
|
|
||||||
|
Thanks to Chad for creating the original Contributing file which we adapted for our use.
|
||||||
|
|
||||||
|
[0]: https://github.com/photonstorm/phaser/issues
|
||||||
|
[1]: http://jsfiddle.net
|
||||||
|
[2]: http://jsbin.com/
|
||||||
|
[3]: http://nodejs.org
|
18
README.md
18
README.md
|
@ -111,7 +111,7 @@ Updates:
|
||||||
* Updated Pixi.js so that removing filters now works correctly without breaking the display list.
|
* Updated Pixi.js so that removing filters now works correctly without breaking the display list.
|
||||||
* Phaser.Canvas.create updated so it can be given an ID as the 3rd parameter (can also be set via new Game configuration object).
|
* Phaser.Canvas.create updated so it can be given an ID as the 3rd parameter (can also be set via new Game configuration object).
|
||||||
* Updated display/fullscreen example to reflect new full screen change.
|
* Updated display/fullscreen example to reflect new full screen change.
|
||||||
* Loads of updates to the TypeScript definitions files - games fully compile now and lots of missing classes added :)
|
* Loads of updates to the TypeScript definitions files - games fully compile now and lots of missing classes added :) (thanks Niondir)
|
||||||
* Removed 'null parent' check from Group constructor. Will parent to game.world only if parent value is undefined.
|
* Removed 'null parent' check from Group constructor. Will parent to game.world only if parent value is undefined.
|
||||||
* The tutorials have now been translated into Spanish - thanks feiss :)
|
* The tutorials have now been translated into Spanish - thanks feiss :)
|
||||||
* separateY updated to re-implement the 'riding platforms' special condition (thanks cocoademon)
|
* separateY updated to re-implement the 'riding platforms' special condition (thanks cocoademon)
|
||||||
|
@ -336,21 +336,21 @@ Beyond version 2.0
|
||||||
Contributing
|
Contributing
|
||||||
------------
|
------------
|
||||||
|
|
||||||
If you find a bug then please report it on github or our forum.
|
We now have a full [Contributors Guide][contribute] which goes into the process in more detail, but here are the headlines:
|
||||||
|
|
||||||
If you have a feature request, or have written a game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you.
|
- If you find a bug then please report it on [GitHub Issues][issues] or our [Support Forum][forum].
|
||||||
|
|
||||||
You can do this on the Phaser board that is part of the [HTML5 Game Devs forum](http://www.html5gamedevs.com/forum/14-phaser/) or email: rich@photonstorm.com
|
- If you have a feature request, or have written a game or demo that shows Phaser in use, then please get in touch. We'd love to hear from you! Either post to our [forum][forum] or email: rich@photonstorm.com
|
||||||
|
|
||||||
If you issue a Pull Request for Phaser, please only ever do so againt the `dev` branch and *not* against the `master` branch.
|
- If you issue a Pull Request for Phaser, please only do so againt the `dev` branch and *not* against the `master` branch.
|
||||||
|
|
||||||
Before submitting a pull request please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, first install it by running `npm install jshint`, then test your code by running `jshint src`. This isn't a requirement, we are happy to receive pull requests that haven't been JSHinted, so don't let it put you off contributing - but do know that we'll reformat your source before going live with it.
|
- Before submitting a Pull Request please run your code through [JSHint](http://www.jshint.com/) to check for stylistic or formatting errors. To use JSHint, first install it by running `npm install jshint`, then test your code by running `jshint src`. This isn't a strict requirement and we are happy to receive Pull Requests that haven't been JSHinted, so don't let it put you off contributing, but do know that we'll reformat your source before going live with it.
|
||||||
|
|
||||||
|
|
||||||
Bugs?
|
Bugs?
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Please add them to the [Issue Tracker][1] with as much info as possible, especially source code demonstrating the issue.
|
Please add them to the [Issue Tracker][issues] with as much info as possible, especially source code demonstrating the issue.
|
||||||
|
|
||||||
![Phaser Tilemap](http://www.photonstorm.com/wp-content/uploads/2013/04/phaser_tilemap_collision.png)
|
![Phaser Tilemap](http://www.photonstorm.com/wp-content/uploads/2013/04/phaser_tilemap_collision.png)
|
||||||
|
|
||||||
|
@ -362,8 +362,10 @@ License
|
||||||
|
|
||||||
Phaser is released under the [MIT License](http://opensource.org/licenses/MIT).
|
Phaser is released under the [MIT License](http://opensource.org/licenses/MIT).
|
||||||
|
|
||||||
[1]: https://github.com/photonstorm/phaser/issues
|
[issues]: https://github.com/photonstorm/phaser/issues
|
||||||
|
[contribute]: https://github.com/photonstorm/phaser/blob/master/CONTRIBUTING.md
|
||||||
[phaser]: https://github.com/photonstorm/phaser
|
[phaser]: https://github.com/photonstorm/phaser
|
||||||
|
[forum]: http://www.html5gamedevs.com/forum/14-phaser/
|
||||||
[koding]: https://koding.com/Teamwork?import=https://github.com/photonstorm/phaser/archive/master.zip&c=git1
|
[koding]: https://koding.com/Teamwork?import=https://github.com/photonstorm/phaser/archive/master.zip&c=git1
|
||||||
|
|
||||||
[![Analytics](https://ga-beacon.appspot.com/UA-44006568-2/phaser/index)](https://github.com/igrigorik/ga-beacon)
|
[![Analytics](https://ga-beacon.appspot.com/UA-44006568-2/phaser/index)](https://github.com/igrigorik/ga-beacon)
|
||||||
|
|
|
@ -828,12 +828,16 @@ Phaser.Physics.Arcade.prototype = {
|
||||||
* @returns {boolean} Returns true if the bodies were separated, otherwise false.
|
* @returns {boolean} Returns true if the bodies were separated, otherwise false.
|
||||||
*/
|
*/
|
||||||
separate: function (body1, body2) {
|
separate: function (body1, body2) {
|
||||||
|
|
||||||
if (body1 !== body2)
|
if (body1 !== body2)
|
||||||
{
|
{
|
||||||
this._result = (this.separateX(body1, body2) || this.separateY(body1, body2));
|
this._result = (this.separateX(body1, body2) || this.separateY(body1, body2));
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this._result = false;
|
this._result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1037,7 +1041,7 @@ Phaser.Physics.Arcade.prototype = {
|
||||||
}
|
}
|
||||||
else if (!body1.immovable)
|
else if (!body1.immovable)
|
||||||
{
|
{
|
||||||
body1.y = body1.y - this._overlap;
|
body1.y -= this._overlap;
|
||||||
body1.velocity.y = this._velocity2 - this._velocity1 * body1.bounce.y;
|
body1.velocity.y = this._velocity2 - this._velocity1 * body1.bounce.y;
|
||||||
|
|
||||||
// This is special case code that handles things like horizontal moving platforms you can ride
|
// This is special case code that handles things like horizontal moving platforms you can ride
|
||||||
|
|
|
@ -108,6 +108,8 @@ Phaser.Time = function (game) {
|
||||||
*/
|
*/
|
||||||
this.lastTime = 0;
|
this.lastTime = 0;
|
||||||
|
|
||||||
|
this._timer = new Phaser.Timer(this.game, 1, false);
|
||||||
|
|
||||||
// Listen for game pause/resume events
|
// Listen for game pause/resume events
|
||||||
this.game.onPause.add(this.gamePaused, this);
|
this.game.onPause.add(this.gamePaused, this);
|
||||||
this.game.onResume.add(this.gameResumed, this);
|
this.game.onResume.add(this.gameResumed, this);
|
||||||
|
@ -128,8 +130,10 @@ Phaser.Time = function (game) {
|
||||||
|
|
||||||
Phaser.Time.prototype = {
|
Phaser.Time.prototype = {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Phaser.Timer object.
|
* Creates a new stand-alone Phaser.Timer object.
|
||||||
* @method Phaser.Time#create
|
* @method Phaser.Time#create
|
||||||
* @param {number} [timeUnit=1000] - The number of ms that represent 1 unit of time. For example a timer that ticks every second would have a timeUnit value of 1000.
|
* @param {number} [timeUnit=1000] - The number of ms that represent 1 unit of time. For example a timer that ticks every second would have a timeUnit value of 1000.
|
||||||
* @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
|
* @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
|
||||||
|
|
|
@ -6,19 +6,17 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
|
* A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
|
||||||
* You can add as many events to a Timer as you like, each with their own delays. A Timer uses its own timeUnit, which directly correlates to milliseconds.
|
* You can add as many events to a Timer as you like, each with their own delays. A Timer uses milliseconds as its unit of time. There are 1000 ms in 1 second.
|
||||||
* For example a Timer with a timeUnit of 250 would fire an event every quarter of a second.
|
* So if you want to fire an event every quarter of a second you'd need to set the delay to 250.
|
||||||
*
|
*
|
||||||
* @class Phaser.Timer
|
* @class Phaser.Timer
|
||||||
* @classdesc A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
|
* @classdesc A Timer is a way to create small re-usable or disposable objects that do nothing but wait for a specific moment in time, and then dispatch an event.
|
||||||
* @constructor
|
* @constructor
|
||||||
* @param {Phaser.Game} game A reference to the currently running game.
|
* @param {Phaser.Game} game A reference to the currently running game.
|
||||||
* @param {number} [timeUnit=1000] - The number of ms that represent 1 unit of time. For example a timer that ticks every second would have a timeUnit value of 1000.
|
|
||||||
* @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
|
* @param {boolean} [autoDestroy=true] - A Timer that is set to automatically destroy itself will do so after all of its events have been dispatched (assuming no looping events).
|
||||||
*/
|
*/
|
||||||
Phaser.Timer = function (game, timeUnit, autoDestroy) {
|
Phaser.Timer = function (game, autoDestroy) {
|
||||||
|
|
||||||
if (typeof timeUnit === 'undefined') { timeUnit = Phaser.Timer.SECOND; }
|
|
||||||
if (typeof autoDestroy === 'undefined') { autoDestroy = true; }
|
if (typeof autoDestroy === 'undefined') { autoDestroy = true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,9 +67,16 @@ Phaser.Timer = function (game, timeUnit, autoDestroy) {
|
||||||
this.onEvent = new Phaser.Signal();
|
this.onEvent = new Phaser.Signal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @property {number} timeUnit - The unit of time being used by this Timer.
|
* @property {number} nextTick - The time the next tick will occur. Do not set this value directly.
|
||||||
|
* @protected
|
||||||
*/
|
*/
|
||||||
this.timeUnit = timeUnit;
|
this.nextTick = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property {number} _now - The current start-time adjusted time.
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
this._now = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -106,57 +111,60 @@ Phaser.Timer.prototype = {
|
||||||
* @method Phaser.Timer#_create
|
* @method Phaser.Timer#_create
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
_create: function (delay, loop, repeatCount, args) {
|
create: function (delay, loop, repeatCount, args) {
|
||||||
|
|
||||||
this.events.push({
|
this.events.push({
|
||||||
delay: delay,
|
delay: delay,
|
||||||
tick: delay,
|
tick: delay,
|
||||||
expired: false,
|
|
||||||
repeatCount: repeatCount,
|
repeatCount: repeatCount,
|
||||||
loop: loop,
|
loop: loop,
|
||||||
args: args
|
args: args
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.order();
|
||||||
|
|
||||||
this.expired = false;
|
this.expired = false;
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Need to do a Stop Watch example
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new Event to this Timer. The event will fire after the given amount of 'delay' has passed if the Timer is running.
|
* Adds a new Event to this Timer. The event will fire after the given amount of 'delay' in milliseconds has passed, once the Timer has started running.
|
||||||
* Call Timer.start() once you have added all of the Events you require for this Timer.
|
* Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
|
||||||
* @method Phaser.Timer#add
|
* @method Phaser.Timer#add
|
||||||
* @param {number} [delay] - The number of timeUnits before the Timer will dispatch its onEvent signal.
|
* @param {number} [delay] - The number of milliseconds before the Timer will dispatch its onEvent signal.
|
||||||
*/
|
*/
|
||||||
add: function (delay) {
|
add: function (delay) {
|
||||||
|
|
||||||
this._create(delay, false, 0, Array.prototype.splice.call(arguments, 1));
|
this.create(delay, false, 0, Array.prototype.splice.call(arguments, 1));
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new Event to this Timer that will repeat for the given number of iterations.
|
* Adds a new Event to this Timer that will repeat for the given number of iterations.
|
||||||
* The event will fire after the given amount of 'delay' has passed if the Timer is running.
|
* The event will fire after the given amount of 'delay' milliseconds has passed once the Timer has started running.
|
||||||
* Call Timer.start() once you have added all of the Events you require for this Timer.
|
* Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
|
||||||
* @method Phaser.Timer#repeat
|
* @method Phaser.Timer#repeat
|
||||||
* @param {number} [delay] - The number of timeUnits before the Timer will dispatch its onEvent signal.
|
* @param {number} [delay] - The number of milliseconds before the Timer will dispatch its onEvent signal.
|
||||||
* @param {number} [count] - The number of times to repeat this Event.
|
* @param {number} [count] - The number of times to repeat this Event.
|
||||||
*/
|
*/
|
||||||
repeat: function (delay, count) {
|
repeat: function (delay, count) {
|
||||||
|
|
||||||
this._create(delay, false, count, Array.prototype.splice.call(arguments, 2));
|
this.create(delay, false, count, Array.prototype.splice.call(arguments, 2));
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new looped Event to this Timer that will repeat forever or until the Timer is stopped.
|
* Adds a new looped Event to this Timer that will repeat forever or until the Timer is stopped.
|
||||||
* The event will fire after the given amount of 'delay' has passed if the Timer is running.
|
* The event will fire after the given amount of 'delay' milliseconds has passed once the Timer has started running.
|
||||||
* Call Timer.start() once you have added all of the Events you require for this Timer.
|
* Call Timer.start() once you have added all of the Events you require for this Timer. The delay is in relation to when the Timer starts, not the time it was added.
|
||||||
* @method Phaser.Timer#loop
|
* @method Phaser.Timer#loop
|
||||||
* @param {number} [delay] - The number of timeUnits before the Timer will dispatch its onEvent signal.
|
* @param {number} [delay] - The number of milliseconds before the Timer will dispatch its onEvent signal.
|
||||||
*/
|
*/
|
||||||
loop: function (delay) {
|
loop: function (delay) {
|
||||||
|
|
||||||
this._create(delay, true, 0, Array.prototype.splice.call(arguments, 1));
|
this.create(delay, true, 0, Array.prototype.splice.call(arguments, 1));
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -182,8 +190,32 @@ Phaser.Timer.prototype = {
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
order: function () {
|
||||||
|
|
||||||
|
// Sort the events so the one with the lowest tick is first
|
||||||
|
this.events.sort(this.sortHandler);
|
||||||
|
|
||||||
|
this.nextTick = this.events[0].tick;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
sortHandler: function (a, b) {
|
||||||
|
|
||||||
|
if (a.tick < b.tick)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
else if (a.tick > b.tick)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main Timer update event.
|
* The main Timer update event, called automatically by the Game clock.
|
||||||
* @method Phaser.Timer#update
|
* @method Phaser.Timer#update
|
||||||
* @protected
|
* @protected
|
||||||
* @param {number} time - The time from the core game clock.
|
* @param {number} time - The time from the core game clock.
|
||||||
|
@ -191,44 +223,52 @@ Phaser.Timer.prototype = {
|
||||||
*/
|
*/
|
||||||
update: function(time) {
|
update: function(time) {
|
||||||
|
|
||||||
if (this.running)
|
this._now = time - this._started;
|
||||||
{
|
|
||||||
var now = (time - this._started) / this.timeUnit;
|
|
||||||
var expired = 0;
|
|
||||||
|
|
||||||
for (var i = 0, len = this.events.length; i < len; i++)
|
if (this.running && this._now >= this.nextTick)
|
||||||
{
|
{
|
||||||
if (this.events[i].expired === false && now >= this.events[i].tick)
|
var i = 0;
|
||||||
|
var len = this.events.length;
|
||||||
|
|
||||||
|
while (i < len)
|
||||||
|
{
|
||||||
|
if (this._now >= this.events[i].tick)
|
||||||
{
|
{
|
||||||
if (this.events[i].loop)
|
if (this.events[i].loop)
|
||||||
{
|
{
|
||||||
this.events[i].tick += this.events[i].delay - (now - this.events[i].tick);
|
this.events[i].tick += this.events[i].delay - (this._now - this.events[i].tick);
|
||||||
this.onEvent.dispatch.apply(this, this.events[i].args);
|
this.onEvent.dispatch.apply(this, this.events[i].args);
|
||||||
}
|
}
|
||||||
else if (this.events[i].repeatCount > 0)
|
else if (this.events[i].repeatCount > 0)
|
||||||
{
|
{
|
||||||
this.events[i].repeatCount--;
|
this.events[i].repeatCount--;
|
||||||
this.events[i].tick += this.events[i].delay - (now - this.events[i].tick);
|
this.events[i].tick += this.events[i].delay - (this._now - this.events[i].tick);
|
||||||
this.onEvent.dispatch.apply(this, this.events[i].args);
|
this.onEvent.dispatch.apply(this, this.events[i].args);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.events[i].expired = true;
|
|
||||||
this.onEvent.dispatch.apply(this, this.events[i].args);
|
this.onEvent.dispatch.apply(this, this.events[i].args);
|
||||||
}
|
this.events.splice(i, 1);
|
||||||
|
len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.events[i].expired)
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
expired++;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are no events left at all
|
// There are no events left at all
|
||||||
if (expired === this.events.length)
|
if (this.events.length > 0)
|
||||||
{
|
{
|
||||||
this.expired = true;
|
this.expired = true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.order();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.expired && this.autoDestroy)
|
if (this.expired && this.autoDestroy)
|
||||||
|
|
Loading…
Reference in a new issue