mirror of
https://github.com/wassname/phaser.git
synced 2026-07-09 00:20:17 +08:00
Sprite.play
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user