Sprite.play

This commit is contained in:
Richard Davey
2013-09-27 13:47:22 +01:00
parent 18c695e9dd
commit 497d15b5bc
2 changed files with 20 additions and 0 deletions
+1
View File
@@ -50,6 +50,7 @@ Version 1.0.7 (in progress in the dev branch)
* Fixed issue in Animation.play where the given frameRate and loop values wouldn't overwrite those set on construction.
* Added Animation.paused - can be set to true/false.
* New: Phaser.Animation.generateFrameNames - really useful when creating animation data from texture atlases using file names, not indexes.
* Added Sprite.play as a handy short-cut to play an animation already loaded onto a Sprite.
* TODO: addMarker hh:mm:ss:ms
+19
View File
@@ -470,6 +470,25 @@ Phaser.Sprite.prototype.getBounds = function(rect) {
}
/**
* Play an animation based on the given key. The animation should previously have been added via sprite.animations.add()
* If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.
*
* @method play
* @param {String} name The name of the animation to be played, e.g. "fire", "walk", "jump".
* @param {Number} [frameRate=null] The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.
* @param {Boolean} [loop=null] Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
* @return {Phaser.Animation} A reference to playing Animation instance.
*/
Phaser.Sprite.prototype.play = function (name, frameRate, loop) {
if (this.animations)
{
this.animations.play(name, frameRate, loop);
}
}
Object.defineProperty(Phaser.Sprite.prototype, 'angle', {
get: function() {