Group nearly done. Sprite.anchor appears to be broken though, must fix.

This commit is contained in:
Richard Davey
2013-09-06 20:20:58 +01:00
parent 822a2df289
commit eb7af3d2a2
11 changed files with 544 additions and 199 deletions
+7 -1
View File
@@ -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);
+10 -1
View File
@@ -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())