Added Matching Pairs game and updated fixed to camera example.

This commit is contained in:
photonstorm
2013-12-16 15:16:44 +00:00
parent 39cae4cc09
commit 7917eac255
8 changed files with 322 additions and 45 deletions
+18
View File
@@ -90,6 +90,18 @@ Phaser.Text = function (game, x, y, text, style) {
*/
this.scale = new Phaser.Point(1, 1);
/**
* An object that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.
* @property {boolean} fixedToCamera - Fixes this object to the Camera.
* @default
*/
this.fixedToCamera = false;
/**
* @property {Phaser.Point} cameraOffset - If this Sprite is fixed to the camera then use this Point to specify how far away from the Camera x/y it's rendered.
*/
this.cameraOffset = new Phaser.Point();
/**
* @property {object} _cache - A mini cache for storing all of the calculated values.
* @private
@@ -141,6 +153,12 @@ Phaser.Text.prototype.update = function() {
return;
}
if (this.fixedToCamera)
{
this.x = this.game.camera.view.x + this.cameraOffset.x;
this.y = this.game.camera.view.y + this.cameraOffset.y;
}
this._cache.dirty = false;
this._cache.x = this.x;