Refactoring of the codebase finished. All classes updated. Ready for final push to 1.0 release.

This commit is contained in:
Richard Davey
2013-04-18 15:48:06 +01:00
parent 6bb4c5e3fc
commit 64d57b8e05
109 changed files with 3458 additions and 3227 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ module Phaser {
export class Emitter extends Group {
/**
* Creates a new <code>FlxEmitter</code> object at a specific position.
* Creates a new <code>Emitter</code> object at a specific position.
* Does NOT automatically generate or attach particles!
*
* @param X The X position of the emitter.
@@ -176,13 +176,13 @@ module Phaser {
/**
* This function generates a new array of particle sprites to attach to the emitter.
*
* @param Graphics If you opted to not pre-configure an array of FlxSprite objects, you can simply pass in a particle image or sprite sheet.
* @param Graphics If you opted to not pre-configure an array of Sprite objects, you can simply pass in a particle image or sprite sheet.
* @param Quantity The number of particles to generate when using the "create from image" option.
* @param BakedRotations How many frames of baked rotation to use (boosts performance). Set to zero to not use baked rotations.
* @param Multiple Whether the image in the Graphics param is a single particle or a bunch of particles (if it's a bunch, they need to be square!).
* @param Collide Whether the particles should be flagged as not 'dead' (non-colliding particles are higher performance). 0 means no collisions, 0-1 controls scale of particle's bounding box.
*
* @return This FlxEmitter instance (nice for chaining stuff together, if you're into that).
* @return This Emitter instance (nice for chaining stuff together, if you're into that).
*/
public makeParticles(Graphics, Quantity: number = 50, BakedRotations: number = 16, Multiple: bool = false, Collide: number = 0.8): Emitter {
@@ -447,9 +447,9 @@ module Phaser {
}
/**
* Change the emitter's midpoint to match the midpoint of a <code>FlxObject</code>.
* Change the emitter's midpoint to match the midpoint of a <code>Object</code>.
*
* @param Object The <code>FlxObject</code> that you want to sync up with.
* @param Object The <code>Object</code> that you want to sync up with.
*/
public at(Object) {
Object.getMidpoint(this._point);
+27 -6
View File
@@ -1,5 +1,6 @@
/// <reference path="../Game.ts" />
/// <reference path="../Basic.ts" />
/// <reference path="../Signal.ts" />
/**
* Phaser
@@ -80,6 +81,15 @@ module Phaser {
public allowCollisions: number;
public last: Point;
// Input
public inputEnabled: bool = false;
private _inputOver: bool = false;
public onInputOver: Phaser.Signal;
public onInputOut: Phaser.Signal;
public onInputDown: Phaser.Signal;
public onInputUp: Phaser.Signal;
public preUpdate() {
// flicker time
@@ -99,9 +109,20 @@ module Phaser {
this.updateMotion();
}
if (this.inputEnabled)
{
this.updateInput();
}
this.wasTouching = this.touching;
this.touching = Collision.NONE;
}
private updateInput() {
}
private updateMotion() {
@@ -129,8 +150,8 @@ module Phaser {
}
/**
* Checks to see if some <code>GameObject</code> overlaps this <code>GameObject</code> or <code>FlxGroup</code>.
* If the group has a LOT of things in it, it might be faster to use <code>FlxG.overlaps()</code>.
* Checks to see if some <code>GameObject</code> overlaps this <code>GameObject</code> or <code>Group</code>.
* If the group has a LOT of things in it, it might be faster to use <code>G.overlaps()</code>.
* WARNING: Currently tilemaps do NOT support screen space overlap checks!
*
* @param ObjectOrGroup The object or group being tested.
@@ -160,7 +181,7 @@ module Phaser {
}
/*
if (typeof ObjectOrGroup === 'FlxTilemap')
if (typeof ObjectOrGroup === 'Tilemap')
{
//Since tilemap's have to be the caller, not the target, to do proper tile-based collisions,
// we redirect the call to the tilemap overlap here.
@@ -190,7 +211,7 @@ module Phaser {
}
/**
* Checks to see if this <code>GameObject</code> were located at the given position, would it overlap the <code>GameObject</code> or <code>FlxGroup</code>?
* Checks to see if this <code>GameObject</code> were located at the given position, would it overlap the <code>GameObject</code> or <code>Group</code>?
* This is distinct from overlapsPoint(), which just checks that ponumber, rather than taking the object's size numbero account.
* WARNING: Currently tilemaps do NOT support screen space overlap checks!
*
@@ -223,13 +244,13 @@ module Phaser {
}
/*
if (typeof ObjectOrGroup === 'FlxTilemap')
if (typeof ObjectOrGroup === 'Tilemap')
{
//Since tilemap's have to be the caller, not the target, to do proper tile-based collisions,
// we redirect the call to the tilemap overlap here.
//However, since this is overlapsAt(), we also have to invent the appropriate position for the tilemap.
//So we calculate the offset between the player and the requested position, and subtract that from the tilemap.
var tilemap: FlxTilemap = ObjectOrGroup;
var tilemap: Tilemap = ObjectOrGroup;
return tilemap.overlapsAt(tilemap.x - (X - this.x), tilemap.y - (Y - this.y), this, InScreenSpace, Camera);
}
*/
+3 -3
View File
@@ -217,7 +217,7 @@ module Phaser {
this._dy -= (camera.worldView.y * this.scrollFactor.y);
}
// Rotation (misleading?)
// Rotation (could be misleading as it doesn't work re: collision)
if (this.angle !== 0)
{
this._game.stage.context.save();
@@ -235,8 +235,8 @@ module Phaser {
this._game.stage.saveCanvasValues();
// Debug
this._game.stage.context.fillStyle = 'rgba(255,0,0,0.5)';
this._game.stage.context.fillRect(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height);
//this._game.stage.context.fillStyle = 'rgba(255,0,0,0.5)';
//this._game.stage.context.fillRect(this.bounds.x, this.bounds.y, this.bounds.width, this.bounds.height);
this._game.stage.context.lineWidth = this.lineWidth;
this._game.stage.context.strokeStyle = this.lineColor;
+5 -3
View File
@@ -1,4 +1,5 @@
/// <reference path="../Game.ts" />
/// <reference path="../AnimationManager.ts" />
/// <reference path="GameObject.ts" />
/**
@@ -15,7 +16,7 @@ module Phaser {
this._texture = null;
this.animations = new Animations(this._game, this);
this.animations = new AnimationManager(this._game, this);
if (key !== null)
{
@@ -34,7 +35,7 @@ module Phaser {
private _context: CanvasRenderingContext2D;
private _dynamicTexture: bool = false;
public animations: Animations;
public animations: AnimationManager;
// local rendering related temp vars to help avoid gc spikes
private _sx: number = 0;
@@ -189,7 +190,8 @@ module Phaser {
if (this.angle !== 0)
{
this._game.stage.context.save();
this._game.stage.context.translate(this._dx + (this._dw / 2) - this.origin.x, this._dy + (this._dh / 2) - this.origin.y);
//this._game.stage.context.translate(this._dx + (this._dw / 2) - this.origin.x, this._dy + (this._dh / 2) - this.origin.y);
this._game.stage.context.translate(this._dx + (this._dw / 2), this._dy + (this._dh / 2));
this._game.stage.context.rotate(this.angle * (Math.PI / 180));
this._dx = -(this._dw / 2);
this._dy = -(this._dh / 2);