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
+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() {