mirror of
https://github.com/wassname/phaser.git
synced 2026-07-05 17:30:19 +08:00
Group nearly done. Sprite.anchor appears to be broken though, must fix.
This commit is contained in:
@@ -26,7 +26,7 @@ Phaser.GameObjectFactory.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Create a new Sprite with specific position and sprite sheet key.
|
||||
* Create a new Sprite with specific position and sprite sheet key that will automatically be added as a child of the given parent.
|
||||
*
|
||||
* @param x {number} X position of the new sprite.
|
||||
* @param y {number} Y position of the new sprite.
|
||||
@@ -55,6 +55,12 @@ Phaser.GameObjectFactory.prototype = {
|
||||
|
||||
},
|
||||
|
||||
group: function (parent, name) {
|
||||
|
||||
return new Phaser.Group(this.game, parent, name);
|
||||
|
||||
},
|
||||
|
||||
audio: function (key, volume, loop) {
|
||||
|
||||
return this.game.sound.add(key, volume, loop);
|
||||
|
||||
@@ -7,9 +7,13 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
||||
|
||||
this.game = game;
|
||||
|
||||
// If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all
|
||||
this.exists = true;
|
||||
this.active = true;
|
||||
|
||||
// An "invisible" sprite isn't rendered at all
|
||||
this.visible = true;
|
||||
|
||||
// This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering
|
||||
this.alive = true;
|
||||
|
||||
this.group = null;
|
||||
@@ -144,6 +148,11 @@ Phaser.Sprite.prototype.constructor = Phaser.Sprite;
|
||||
*/
|
||||
Phaser.Sprite.prototype.update = function() {
|
||||
|
||||
if (!this.exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._cache.dirty = false;
|
||||
|
||||
if (this.animations.update())
|
||||
|
||||
Reference in New Issue
Block a user