Reverting back to the only version of TypeScript that really works :(

This commit is contained in:
Richard Davey
2013-08-13 04:22:24 +01:00
parent 91dc7a4acf
commit 619b8415ed
184 changed files with 11984 additions and 32842 deletions
+17 -17
View File
@@ -67,15 +67,15 @@ module Phaser {
/**
* Whether load complete loading or not.
* @type {boolean}
* @type {bool}
*/
private _loadComplete: boolean = false;
private _loadComplete: bool = false;
/**
* Game is paused?
* @type {boolean}
* @type {bool}
*/
private _paused: boolean = false;
private _paused: bool = false;
/**
* The state to be switched to in the next frame.
@@ -234,9 +234,9 @@ module Phaser {
/**
* Reference to the physics manager.
* @type {Physics.Manager}
* @type {Physics.PhysicsManager}
*/
//public physics: Phaser.Physics.Manager;
public physics: Phaser.Physics.PhysicsManager;
/**
* Instance of repeatable random data generator helper.
@@ -258,15 +258,15 @@ module Phaser {
/**
* Whether the game engine is booted, aka available.
* @type {boolean}
* @type {bool}
*/
public isBooted: boolean = false;
public isBooted: bool = false;
/**
* Is game running or paused?
* @type {boolean}
* @type {bool}
*/
public isRunning: boolean = false;
public isRunning: bool = false;
/**
* Initialize engine sub modules and start the game.
@@ -306,7 +306,7 @@ module Phaser {
this.input = new Phaser.InputManager(this);
this.sound = new Phaser.SoundManager(this);
this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()]);
//this.physics = new Phaser.Physics.Manager(this);
this.physics = new Phaser.Physics.PhysicsManager(this);
this.plugins = new Phaser.PluginManager(this, this);
this.load.onLoadComplete.add(this.loadComplete, this);
@@ -398,7 +398,7 @@ module Phaser {
this.input.update();
this.stage.update();
this.sound.update();
//this.physics.update();
this.physics.update();
this.world.update();
this.plugins.update();
@@ -516,10 +516,10 @@ module Phaser {
/**
* Switch to a new State.
* @param state {State} The state you want to switch to.
* @param [clearWorld] {boolean} clear everything in the world? (Default to true)
* @param [clearCache] {boolean} clear asset cache? (Default to false and ONLY available when clearWorld=true)
* @param [clearWorld] {bool} clear everything in the world? (Default to true)
* @param [clearCache] {bool} clear asset cache? (Default to false and ONLY available when clearWorld=true)
*/
public switchState(state, clearWorld: boolean = true, clearCache: boolean = false) {
public switchState(state, clearWorld: bool = true, clearCache: bool = false) {
if (this.isBooted == false)
{
@@ -648,11 +648,11 @@ module Phaser {
}
public get paused(): boolean {
public get paused(): bool {
return this._paused;
}
public set paused(value: boolean) {
public set paused(value: bool) {
if (value == true && this._paused == false)
{
+120 -435
View File
@@ -16,451 +16,136 @@
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<ItemGroup>
<TypeScriptCompile Include="_definitions.ts" />
<TypeScriptCompile Include="Phaser.ts" />
<TypeScriptCompile Include="Statics.ts" />
<TypeScriptCompile Include="geom\Point.ts" />
<TypeScriptCompile Include="geom\Rectangle.ts" />
<TypeScriptCompile Include="geom\Circle.ts" />
<TypeScriptCompile Include="geom\Line.ts" />
<TypeScriptCompile Include="math\GameMath.ts" />
<TypeScriptCompile Include="math\Vec2.ts" />
<TypeScriptCompile Include="math\Vec2Utils.ts" />
<TypeScriptCompile Include="math\Mat3.ts" />
<TypeScriptCompile Include="math\Mat3Utils.ts" />
<TypeScriptCompile Include="math\QuadTree.ts" />
<TypeScriptCompile Include="math\LinkedList.ts" />
<TypeScriptCompile Include="math\RandomDataGenerator.ts" />
<TypeScriptCompile Include="core\Plugin.ts" />
<TypeScriptCompile Include="core\PluginManager.ts" />
<TypeScriptCompile Include="core\Signal.ts" />
<TypeScriptCompile Include="core\SignalBinding.ts" />
<TypeScriptCompile Include="core\Group.ts" />
<TypeScriptCompile Include="cameras\Camera.ts" />
<TypeScriptCompile Include="cameras\CameraManager.ts" />
<TypeScriptCompile Include="display\CSS3Filters.ts" />
<TypeScriptCompile Include="display\DynamicTexture.ts" />
<TypeScriptCompile Include="display\Texture.ts" />
<TypeScriptCompile Include="tweens\easing\Back.ts" />
<TypeScriptCompile Include="tweens\easing\Bounce.ts" />
<TypeScriptCompile Include="tweens\easing\Circular.ts" />
<TypeScriptCompile Include="tweens\easing\Cubic.ts" />
<TypeScriptCompile Include="tweens\easing\Elastic.ts" />
<TypeScriptCompile Include="tweens\easing\Exponential.ts" />
<TypeScriptCompile Include="tweens\easing\Linear.ts" />
<TypeScriptCompile Include="tweens\easing\Quadratic.ts" />
<TypeScriptCompile Include="tweens\easing\Quartic.ts" />
<TypeScriptCompile Include="tweens\easing\Quintic.ts" />
<TypeScriptCompile Include="tweens\easing\Sinusoidal.ts" />
<TypeScriptCompile Include="tweens\Tween.ts" />
<TypeScriptCompile Include="tweens\TweenManager.ts" />
<TypeScriptCompile Include="time\TimeManager.ts" />
<TypeScriptCompile Include="net\Net.ts" />
<TypeScriptCompile Include="input\Keyboard.ts" />
<TypeScriptCompile Include="input\Mouse.ts" />
<TypeScriptCompile Include="input\MSPointer.ts" />
<TypeScriptCompile Include="input\Touch.ts" />
<TypeScriptCompile Include="input\Pointer.ts" />
<TypeScriptCompile Include="input\InputHandler.ts" />
<TypeScriptCompile Include="input\InputManager.ts" />
<TypeScriptCompile Include="system\Device.ts" />
<TypeScriptCompile Include="system\RequestAnimationFrame.ts" />
<TypeScriptCompile Include="system\StageScaleMode.ts" />
<TypeScriptCompile Include="system\screens\BootScreen.ts" />
<TypeScriptCompile Include="system\screens\OrientationScreen.ts" />
<TypeScriptCompile Include="system\screens\PauseScreen.ts" />
<TypeScriptCompile Include="sound\SoundManager.ts" />
<TypeScriptCompile Include="sound\Sound.ts" />
<TypeScriptCompile Include="animation\Animation.ts" />
<TypeScriptCompile Include="animation\AnimationManager.ts" />
<TypeScriptCompile Include="animation\Frame.ts" />
<TypeScriptCompile Include="animation\FrameData.ts" />
<TypeScriptCompile Include="loader\Cache.ts" />
<TypeScriptCompile Include="loader\Loader.ts" />
<TypeScriptCompile Include="loader\AnimationLoader.ts" />
<TypeScriptCompile Include="tilemap\Tile.ts" />
<TypeScriptCompile Include="tilemap\Tilemap.ts" />
<TypeScriptCompile Include="tilemap\TilemapLayer.ts" />
<TypeScriptCompile Include="physics\PhysicsManager.ts" />
<TypeScriptCompile Include="physics\Body.ts" />
<TypeScriptCompile Include="physics\AABB.ts" />
<TypeScriptCompile Include="physics\Circle.ts" />
<TypeScriptCompile Include="physics\TileMapCell.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABB22Deg.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABB45Deg.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABB67Deg.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABBConcave.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABBConvex.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABBFull.ts" />
<TypeScriptCompile Include="physics\aabb\ProjAABBHalf.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircle22Deg.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircle45Deg.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircle67Deg.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircleConcave.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircleConvex.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircleFull.ts" />
<TypeScriptCompile Include="physics\circle\ProjCircleHalf.ts" />
<TypeScriptCompile Include="gameobjects\Events.ts" />
<TypeScriptCompile Include="gameobjects\Sprite.ts" />
<TypeScriptCompile Include="gameobjects\TransformManager.ts" />
<TypeScriptCompile Include="gameobjects\ScrollRegion.ts" />
<TypeScriptCompile Include="gameobjects\ScrollZone.ts" />
<TypeScriptCompile Include="gameobjects\IGameObject.ts" />
<TypeScriptCompile Include="gameobjects\GameObjectFactory.ts" />
<TypeScriptCompile Include="ui\Button.ts" />
<TypeScriptCompile Include="utils\CanvasUtils.ts" />
<TypeScriptCompile Include="particles\ParticlePool.ts" />
<TypeScriptCompile Include="utils\CircleUtils.ts" />
<TypeScriptCompile Include="utils\ColorUtils.ts" />
<TypeScriptCompile Include="utils\PointUtils.ts" />
<TypeScriptCompile Include="utils\RectangleUtils.ts" />
<TypeScriptCompile Include="utils\SpriteUtils.ts" />
<TypeScriptCompile Include="utils\DebugUtils.ts" />
<TypeScriptCompile Include="renderers\IRenderer.ts" />
<TypeScriptCompile Include="renderers\HeadlessRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\CameraRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\GeometryRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\GroupRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\ScrollZoneRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\SpriteRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\TilemapRenderer.ts" />
<TypeScriptCompile Include="renderers\canvas\CanvasRenderer.ts" />
<TypeScriptCompile Include="particles\ParticleManager.ts" />
<TypeScriptCompile Include="particles\initialize\Mass.ts" />
<TypeScriptCompile Include="particles\initialize\Initialize.ts" />
<TypeScriptCompile Include="particles\behaviours\Behaviour.ts" />
<Content Include="particles\behaviours\Behaviour.js">
<DependentUpon>Behaviour.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\behaviours\RandomDrift.ts" />
<Content Include="particles\behaviours\RandomDrift.js">
<DependentUpon>RandomDrift.ts</DependentUpon>
</Content>
<Content Include="particles\initialize\Initialize.js">
<DependentUpon>Initialize.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\initialize\Life.ts" />
<Content Include="particles\initialize\Life.js">
<DependentUpon>Life.ts</DependentUpon>
</Content>
<Content Include="particles\initialize\Mass.js">
<DependentUpon>Mass.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\initialize\Radius.ts" />
<TypeScriptCompile Include="particles\initialize\Position.ts" />
<Content Include="particles\initialize\Position.js">
<DependentUpon>Position.ts</DependentUpon>
</Content>
<Content Include="particles\initialize\Radius.js">
<DependentUpon>Radius.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\initialize\Rate.ts" />
<Content Include="particles\initialize\Rate.js">
<DependentUpon>Rate.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\initialize\Velocity.ts" />
<Content Include="particles\initialize\Velocity.js">
<DependentUpon>Velocity.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\NumericalIntegration.ts" />
<Content Include="particles\NumericalIntegration.js">
<DependentUpon>NumericalIntegration.ts</DependentUpon>
</Content>
<Content Include="particles\ParticleManager.js">
<DependentUpon>ParticleManager.ts</DependentUpon>
</Content>
<Content Include="particles\ParticlePool.js">
<DependentUpon>ParticlePool.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\Particle.ts" />
<TypeScriptCompile Include="particles\Emitter.ts" />
<TypeScriptCompile Include="particles\ParticlePool.ts" />
<TypeScriptCompile Include="particles\ParticleUtils.ts" />
<Content Include="particles\ParticleUtils.js">
<DependentUpon>ParticleUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\Span.ts" />
<TypeScriptCompile Include="particles\Polar2D.ts" />
<Content Include="particles\Polar2D.js">
<DependentUpon>Polar2D.ts</DependentUpon>
</Content>
<Content Include="particles\Span.js">
<DependentUpon>Span.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\Span.ts" />
<TypeScriptCompile Include="particles\NumericalIntegration.ts" />
<TypeScriptCompile Include="particles\behaviours\Behaviour.ts" />
<TypeScriptCompile Include="particles\behaviours\RandomDrift.ts" />
<TypeScriptCompile Include="particles\initialize\Initialize.ts" />
<TypeScriptCompile Include="particles\initialize\Life.ts" />
<TypeScriptCompile Include="particles\initialize\Mass.ts" />
<TypeScriptCompile Include="particles\initialize\Position.ts" />
<TypeScriptCompile Include="particles\initialize\Rate.ts" />
<TypeScriptCompile Include="particles\initialize\Velocity.ts" />
<TypeScriptCompile Include="particles\zone\Zone.ts" />
<TypeScriptCompile Include="particles\zone\PointZone.ts" />
<Content Include="particles\zone\PointZone.js">
<DependentUpon>PointZone.ts</DependentUpon>
</Content>
<Content Include="particles\zone\Zone.js">
<DependentUpon>Zone.ts</DependentUpon>
</Content>
<Content Include="utils\CanvasUtils.js">
<DependentUpon>CanvasUtils.ts</DependentUpon>
</Content>
<Content Include="_definitions.ts" />
<TypeScriptCompile Include="Phaser.ts" />
<TypeScriptCompile Include="particles\Emitter.ts" />
<Content Include="particles\Emitter.js">
<DependentUpon>Emitter.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="particles\Particle.ts" />
<Content Include="particles\Particle.js">
<DependentUpon>Particle.ts</DependentUpon>
</Content>
<Content Include="Phaser.js">
<DependentUpon>Phaser.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="Statics.ts" />
<Content Include="Statics.js">
<DependentUpon>Statics.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geom\Point.ts" />
<Content Include="geom\Point.js">
<DependentUpon>Point.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geom\Rectangle.ts" />
<Content Include="geom\Rectangle.js">
<DependentUpon>Rectangle.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geom\Circle.ts" />
<Content Include="geom\Circle.js">
<DependentUpon>Circle.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="geom\Line.ts" />
<Content Include="geom\Line.js">
<DependentUpon>Line.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\GameMath.ts" />
<Content Include="math\GameMath.js">
<DependentUpon>GameMath.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\Vec2.ts" />
<Content Include="math\Vec2.js">
<DependentUpon>Vec2.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\Vec2Utils.ts" />
<Content Include="math\Vec2Utils.js">
<DependentUpon>Vec2Utils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\Mat3.ts" />
<Content Include="math\Mat3.js">
<DependentUpon>Mat3.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\Mat3Utils.ts" />
<Content Include="math\Mat3Utils.js">
<DependentUpon>Mat3Utils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\QuadTree.ts" />
<Content Include="math\QuadTree.js">
<DependentUpon>QuadTree.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\LinkedList.ts" />
<Content Include="math\LinkedList.js">
<DependentUpon>LinkedList.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="math\RandomDataGenerator.ts" />
<Content Include="math\RandomDataGenerator.js">
<DependentUpon>RandomDataGenerator.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="core\Plugin.ts" />
<Content Include="core\Plugin.js">
<DependentUpon>Plugin.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="core\PluginManager.ts" />
<Content Include="core\PluginManager.js">
<DependentUpon>PluginManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="core\Signal.ts" />
<Content Include="core\Signal.js">
<DependentUpon>Signal.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="core\SignalBinding.ts" />
<Content Include="core\SignalBinding.js">
<DependentUpon>SignalBinding.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="core\Group.ts" />
<Content Include="core\Group.js">
<DependentUpon>Group.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="cameras\Camera.ts" />
<Content Include="cameras\Camera.js">
<DependentUpon>Camera.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="cameras\CameraManager.ts" />
<Content Include="cameras\CameraManager.js">
<DependentUpon>CameraManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="display\CSS3Filters.ts" />
<Content Include="display\CSS3Filters.js">
<DependentUpon>CSS3Filters.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="display\DynamicTexture.ts" />
<Content Include="display\DynamicTexture.js">
<DependentUpon>DynamicTexture.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="display\Texture.ts" />
<Content Include="display\Texture.js">
<DependentUpon>Texture.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Back.ts" />
<Content Include="tweens\easing\Back.js">
<DependentUpon>Back.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Bounce.ts" />
<Content Include="tweens\easing\Bounce.js">
<DependentUpon>Bounce.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Circular.ts" />
<Content Include="tweens\easing\Circular.js">
<DependentUpon>Circular.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Cubic.ts" />
<Content Include="tweens\easing\Cubic.js">
<DependentUpon>Cubic.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Elastic.ts" />
<Content Include="tweens\easing\Elastic.js">
<DependentUpon>Elastic.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Exponential.ts" />
<Content Include="tweens\easing\Exponential.js">
<DependentUpon>Exponential.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Linear.ts" />
<Content Include="tweens\easing\Linear.js">
<DependentUpon>Linear.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Quadratic.ts" />
<Content Include="tweens\easing\Quadratic.js">
<DependentUpon>Quadratic.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Quartic.ts" />
<Content Include="tweens\easing\Quartic.js">
<DependentUpon>Quartic.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Quintic.ts" />
<Content Include="tweens\easing\Quintic.js">
<DependentUpon>Quintic.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\easing\Sinusoidal.ts" />
<Content Include="tweens\easing\Sinusoidal.js">
<DependentUpon>Sinusoidal.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\Tween.ts" />
<Content Include="tweens\Tween.js">
<DependentUpon>Tween.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tweens\TweenManager.ts" />
<Content Include="tweens\TweenManager.js">
<DependentUpon>TweenManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="time\TimeManager.ts" />
<Content Include="time\TimeManager.js">
<DependentUpon>TimeManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="net\Net.ts" />
<Content Include="net\Net.js">
<DependentUpon>Net.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\Keyboard.ts" />
<Content Include="input\Keyboard.js">
<DependentUpon>Keyboard.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\Mouse.ts" />
<Content Include="input\Mouse.js">
<DependentUpon>Mouse.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\MSPointer.ts" />
<Content Include="input\MSPointer.js">
<DependentUpon>MSPointer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\Touch.ts" />
<Content Include="input\Touch.js">
<DependentUpon>Touch.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\Pointer.ts" />
<Content Include="input\Pointer.js">
<DependentUpon>Pointer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\InputHandler.ts" />
<Content Include="input\InputHandler.js">
<DependentUpon>InputHandler.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="input\InputManager.ts" />
<Content Include="input\InputManager.js">
<DependentUpon>InputManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\Device.ts" />
<Content Include="system\Device.js">
<DependentUpon>Device.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\RequestAnimationFrame.ts" />
<Content Include="system\RequestAnimationFrame.js">
<DependentUpon>RequestAnimationFrame.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\StageScaleMode.ts" />
<Content Include="system\StageScaleMode.js">
<DependentUpon>StageScaleMode.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\screens\BootScreen.ts" />
<Content Include="system\screens\BootScreen.js">
<DependentUpon>BootScreen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\screens\OrientationScreen.ts" />
<Content Include="system\screens\OrientationScreen.js">
<DependentUpon>OrientationScreen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="system\screens\PauseScreen.ts" />
<Content Include="system\screens\PauseScreen.js">
<DependentUpon>PauseScreen.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="sound\SoundManager.ts" />
<Content Include="sound\SoundManager.js">
<DependentUpon>SoundManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="sound\Sound.ts" />
<Content Include="sound\Sound.js">
<DependentUpon>Sound.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="animation\Animation.ts" />
<Content Include="animation\Animation.js">
<DependentUpon>Animation.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="animation\AnimationManager.ts" />
<Content Include="animation\AnimationManager.js">
<DependentUpon>AnimationManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="animation\Frame.ts" />
<Content Include="animation\Frame.js">
<DependentUpon>Frame.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="animation\FrameData.ts" />
<Content Include="animation\FrameData.js">
<DependentUpon>FrameData.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="loader\Cache.ts" />
<Content Include="loader\Cache.js">
<DependentUpon>Cache.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="loader\Loader.ts" />
<Content Include="loader\Loader.js">
<DependentUpon>Loader.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="loader\AnimationLoader.ts" />
<Content Include="loader\AnimationLoader.js">
<DependentUpon>AnimationLoader.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\Tile.ts" />
<Content Include="tilemap\Tile.js">
<DependentUpon>Tile.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\Tilemap.ts" />
<Content Include="tilemap\Tilemap.js">
<DependentUpon>Tilemap.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="tilemap\TilemapLayer.ts" />
<Content Include="tilemap\TilemapLayer.js">
<DependentUpon>TilemapLayer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\Events.ts" />
<Content Include="gameobjects\Events.js">
<DependentUpon>Events.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\Sprite.ts" />
<Content Include="gameobjects\Sprite.js">
<DependentUpon>Sprite.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\TransformManager.ts" />
<Content Include="gameobjects\TransformManager.js">
<DependentUpon>TransformManager.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\ScrollRegion.ts" />
<Content Include="gameobjects\ScrollRegion.js">
<DependentUpon>ScrollRegion.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\ScrollZone.ts" />
<Content Include="gameobjects\ScrollZone.js">
<DependentUpon>ScrollZone.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\IGameObject.ts" />
<Content Include="gameobjects\IGameObject.js">
<DependentUpon>IGameObject.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="gameobjects\GameObjectFactory.ts" />
<Content Include="gameobjects\GameObjectFactory.js">
<DependentUpon>GameObjectFactory.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="ui\Button.ts" />
<Content Include="ui\Button.js">
<DependentUpon>Button.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\CircleUtils.ts" />
<Content Include="utils\CircleUtils.js">
<DependentUpon>CircleUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\ColorUtils.ts" />
<Content Include="utils\ColorUtils.js">
<DependentUpon>ColorUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\PointUtils.ts" />
<Content Include="utils\PointUtils.js">
<DependentUpon>PointUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\RectangleUtils.ts" />
<Content Include="utils\RectangleUtils.js">
<DependentUpon>RectangleUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\SpriteUtils.ts" />
<Content Include="utils\SpriteUtils.js">
<DependentUpon>SpriteUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="utils\DebugUtils.ts" />
<Content Include="utils\DebugUtils.js">
<DependentUpon>DebugUtils.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\IRenderer.ts" />
<Content Include="renderers\IRenderer.js">
<DependentUpon>IRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\HeadlessRenderer.ts" />
<Content Include="renderers\HeadlessRenderer.js">
<DependentUpon>HeadlessRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\CameraRenderer.ts" />
<Content Include="renderers\canvas\CameraRenderer.js">
<DependentUpon>CameraRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\GeometryRenderer.ts" />
<Content Include="renderers\canvas\GeometryRenderer.js">
<DependentUpon>GeometryRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\GroupRenderer.ts" />
<Content Include="renderers\canvas\GroupRenderer.js">
<DependentUpon>GroupRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\ScrollZoneRenderer.ts" />
<Content Include="renderers\canvas\ScrollZoneRenderer.js">
<DependentUpon>ScrollZoneRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\SpriteRenderer.ts" />
<Content Include="renderers\canvas\SpriteRenderer.js">
<DependentUpon>SpriteRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\TilemapRenderer.ts" />
<Content Include="renderers\canvas\TilemapRenderer.js">
<DependentUpon>TilemapRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="renderers\canvas\CanvasRenderer.ts" />
<Content Include="renderers\canvas\CanvasRenderer.js">
<DependentUpon>CanvasRenderer.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="World.ts" />
<Content Include="World.js">
<DependentUpon>World.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="Stage.ts" />
<Content Include="Stage.js">
<DependentUpon>Stage.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="State.ts" />
<Content Include="State.js">
<DependentUpon>State.ts</DependentUpon>
</Content>
<TypeScriptCompile Include="Game.ts" />
<Content Include="Game.js">
<DependentUpon>Game.ts</DependentUpon>
</Content>
</ItemGroup>
<ItemGroup />
<PropertyGroup>
+10 -10
View File
@@ -106,9 +106,9 @@ module Phaser {
/**
* Clear the whole stage every frame? (Default to true)
* @type {boolean}
* @type {bool}
*/
public clear: boolean = true;
public clear: bool = true;
/**
* Canvas element used by engine.
@@ -125,16 +125,16 @@ module Phaser {
/**
* Do not use pause screen when game is paused?
* (Default to false, aka always use PauseScreen)
* @type {boolean}
* @type {bool}
*/
public disablePauseScreen: boolean = false;
public disablePauseScreen: bool = false;
/**
* Do not use boot screen when engine starts?
* (Default to false, aka always use BootScreen)
* @type {boolean}
* @type {bool}
*/
public disableBootScreen: boolean = false;
public disableBootScreen: bool = false;
/**
* Offset from this stage to the canvas element.
@@ -157,9 +157,9 @@ module Phaser {
/**
* If set to true the game will never pause when the browser or browser tab loses focuses
* @type {boolean}
* @type {bool}
*/
public disableVisibilityChange: boolean = false;
public disableVisibilityChange: bool = false;
/**
* Stage boot
@@ -245,7 +245,7 @@ module Phaser {
}
public enableOrientationCheck(forceLandscape: boolean, forcePortrait: boolean, imageKey: string = '') {
public enableOrientationCheck(forceLandscape: bool, forcePortrait: bool, imageKey: string = '') {
this.scale.forceLandscape = forceLandscape;
this.scale.forcePortrait = forcePortrait;
@@ -296,7 +296,7 @@ module Phaser {
/**
* Get the DOM offset values of the given element
*/
public getOffset(element, populateOffset: boolean = true): Point {
public getOffset(element, populateOffset: bool = true): Point {
var box = element.getBoundingClientRect();
+2 -2
View File
@@ -151,9 +151,9 @@ module Phaser {
* @param notifyCallback A callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you passed them to Collision.overlap.
* @param processCallback A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then notifyCallback will only be called if processCallback returns true.
* @param context The context in which the callbacks will be called
* @returns {boolean} true if the objects overlap, otherwise false.
* @returns {bool} true if the objects overlap, otherwise false.
*/
//public collide(objectOrGroup1 = null, objectOrGroup2 = null, notifyCallback = null, context? = this.game.callbackContext): boolean {
//public collide(objectOrGroup1 = null, objectOrGroup2 = null, notifyCallback = null, context? = this.game.callbackContext): bool {
// return this.collision.overlap(objectOrGroup1, objectOrGroup2, notifyCallback, Collision.separate, context);
//}
+2 -2
View File
@@ -119,9 +119,9 @@ module Phaser {
*
* @param width {number} New width of the world.
* @param height {number} New height of the world.
* @param [updateCameraBounds] {boolean} Update camera bounds automatically or not. Default to true.
* @param [updateCameraBounds] {bool} Update camera bounds automatically or not. Default to true.
*/
public setSize(width: number, height: number, updateCameraBounds: boolean = true) {
public setSize(width: number, height: number, updateCameraBounds: bool = true) {
this.bounds.width = width;
this.bounds.height = height;
+22 -22
View File
@@ -78,6 +78,28 @@
/// <reference path="tilemap/Tilemap.ts" />
/// <reference path="tilemap/TilemapLayer.ts" />
/// <reference path="physics/PhysicsManager.ts" />
/// <reference path="physics/Body.ts" />
/// <reference path="physics/AABB.ts" />
/// <reference path="physics/Circle.ts" />
/// <reference path="physics/TileMapCell.ts" />
/// <reference path="physics/aabb/ProjAABB22Deg.ts" />
/// <reference path="physics/aabb/ProjAABB45Deg.ts" />
/// <reference path="physics/aabb/ProjAABB67Deg.ts" />
/// <reference path="physics/aabb/ProjAABBConcave.ts" />
/// <reference path="physics/aabb/ProjAABBConvex.ts" />
/// <reference path="physics/aabb/ProjAABBFull.ts" />
/// <reference path="physics/aabb/ProjAABBHalf.ts" />
/// <reference path="physics/circle/ProjCircle22Deg.ts" />
/// <reference path="physics/circle/ProjCircle45Deg.ts" />
/// <reference path="physics/circle/ProjCircle67Deg.ts" />
/// <reference path="physics/circle/ProjCircleConcave.ts" />
/// <reference path="physics/circle/ProjCircleConvex.ts" />
/// <reference path="physics/circle/ProjCircleFull.ts" />
/// <reference path="physics/circle/ProjCircleHalf.ts" />
/// <reference path="gameobjects/Events.ts" />
/// <reference path="gameobjects/Sprite.ts" />
/// <reference path="gameobjects/TransformManager.ts" />
@@ -106,28 +128,6 @@
/// <reference path="renderers/canvas/TilemapRenderer.ts" />
/// <reference path="renderers/canvas/CanvasRenderer.ts" />
// <reference path="physics/PhysicsManager.ts" />
// <reference path="physics/Body.ts" />
// <reference path="physics/AABB.ts" />
// <reference path="physics/Circle.ts" />
// <reference path="physics/TileMapCell.ts" />
// <reference path="physics/aabb/ProjAABB22Deg.ts" />
// <reference path="physics/aabb/ProjAABB45Deg.ts" />
// <reference path="physics/aabb/ProjAABB67Deg.ts" />
// <reference path="physics/aabb/ProjAABBConcave.ts" />
// <reference path="physics/aabb/ProjAABBConvex.ts" />
// <reference path="physics/aabb/ProjAABBFull.ts" />
// <reference path="physics/aabb/ProjAABBHalf.ts" />
// <reference path="physics/circle/ProjCircle22Deg.ts" />
// <reference path="physics/circle/ProjCircle45Deg.ts" />
// <reference path="physics/circle/ProjCircle67Deg.ts" />
// <reference path="physics/circle/ProjCircleConcave.ts" />
// <reference path="physics/circle/ProjCircleConvex.ts" />
// <reference path="physics/circle/ProjCircleFull.ts" />
// <reference path="physics/circle/ProjCircleHalf.ts" />
/// <reference path="particles/ParticleManager.ts" />
/// <reference path="particles/Particle.ts" />
/// <reference path="particles/Emitter.ts" />
+11 -11
View File
@@ -25,9 +25,9 @@ module Phaser {
* @param name {string} Unique name of this animation.
* @param frames {number[]/string[]} An array of numbers or strings indicating what frames to play in what order.
* @param delay {number} Time between frames in ms.
* @param looped {boolean} Whether or not the animation is looped or just plays once.
* @param looped {bool} Whether or not the animation is looped or just plays once.
*/
constructor(game: Game, parent: Sprite, frameData: FrameData, name: string, frames, delay: number, looped: boolean) {
constructor(game: Game, parent: Sprite, frameData: FrameData, name: string, frames, delay: number, looped: bool) {
this.game = game;
this._parent = parent;
@@ -98,21 +98,21 @@ module Phaser {
/**
* Whether or not this animation finished playing.
* @type {boolean}
* @type {bool}
*/
public isFinished: boolean;
public isFinished: bool;
/**
* Whethor or not this animation is currently playing.
* @type {boolean}
* @type {bool}
*/
public isPlaying: boolean;
public isPlaying: bool;
/**
* Whether or not the animation is looped.
* @type {boolean}
* @type {bool}
*/
public looped: boolean;
public looped: bool;
/**
* Time between frames in ms.
@@ -153,9 +153,9 @@ module Phaser {
/**
* Play this animation.
* @param frameRate {number} FrameRate you want to specify instead of using default.
* @param loop {boolean} Whether or not the animation is looped or just plays once.
* @param loop {bool} Whether or not the animation is looped or just plays once.
*/
public play(frameRate: number = null, loop: boolean = false) {
public play(frameRate: number = null, loop: bool = false) {
if (frameRate !== null)
{
@@ -208,7 +208,7 @@ module Phaser {
/**
* Update animation frames.
*/
public update(): boolean {
public update(): bool {
if (this.isPlaying == true && this.game.time.now >= this._timeNextFrame)
{
+10 -10
View File
@@ -61,9 +61,9 @@ module Phaser.Components {
* When an animation frame changes you can choose to automatically update the physics bounds of the parent Sprite
* to the width and height of the new frame. If you've set a specific physics bounds that you don't want changed during
* animation then set this to false, otherwise leave it set to true.
* @type {boolean}
* @type {bool}
*/
public autoUpdateBounds: boolean = true;
public autoUpdateBounds: bool = true;
/**
* Keeps track of the current animation being played.
@@ -92,11 +92,11 @@ module Phaser.Components {
* @param name {string} What this animation should be called (e.g. "run").
* @param frames {any[]} An array of numbers/strings indicating what frames to play in what order (e.g. [1, 2, 3] or ['run0', 'run1', run2]).
* @param frameRate {number} The speed in frames per second that the animation should play at (e.g. 60 fps).
* @param loop {boolean} Whether or not the animation is looped or just plays once.
* @param useNumericIndex {boolean} Use number indexes instead of string indexes?
* @param loop {bool} Whether or not the animation is looped or just plays once.
* @param useNumericIndex {bool} Use number indexes instead of string indexes?
* @return {Animation} The Animation that was created
*/
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: boolean = false, useNumericIndex: boolean = true): Phaser.Animation {
public add(name: string, frames: any[] = null, frameRate: number = 60, loop: bool = false, useNumericIndex: bool = true): Phaser.Animation {
if (this._frameData == null)
{
@@ -141,10 +141,10 @@ module Phaser.Components {
/**
* Check whether the frames is valid.
* @param frames {any[]} Frames to be validated.
* @param useNumericIndex {boolean} Does these frames use number indexes or string indexes?
* @return {boolean} True if they're valid, otherwise return false.
* @param useNumericIndex {bool} Does these frames use number indexes or string indexes?
* @return {bool} True if they're valid, otherwise return false.
*/
private validateFrames(frames: any[], useNumericIndex: boolean): boolean {
private validateFrames(frames: any[], useNumericIndex: bool): bool {
for (var i = 0; i < frames.length; i++)
{
@@ -172,9 +172,9 @@ module Phaser.Components {
* Play animation with specific name.
* @param name {string} The string name of the animation you want to play.
* @param frameRate {number} FrameRate you want to specify instead of using default.
* @param loop {boolean} Whether or not the animation is looped or just plays once.
* @param loop {bool} Whether or not the animation is looped or just plays once.
*/
public play(name: string, frameRate: number = null, loop: boolean = false): Animation {
public play(name: string, frameRate: number = null, loop: bool = false): Animation {
if (this._anims[name])
{
+6 -6
View File
@@ -76,7 +76,7 @@ module Phaser {
/**
* Rotated? (not yet implemented)
*/
public rotated: boolean = false;
public rotated: bool = false;
/**
* Either cw or ccw, rotation is always 90 degrees.
@@ -85,9 +85,9 @@ module Phaser {
/**
* Was it trimmed when packed?
* @type {boolean}
* @type {bool}
*/
public trimmed: boolean;
public trimmed: bool;
// The coordinates of the trimmed sprite inside the original sprite
@@ -130,13 +130,13 @@ module Phaser {
/**
* Set rotation of this frame. (Not yet supported!)
*/
public setRotation(rotated: boolean, rotationDirection: string) {
public setRotation(rotated: bool, rotationDirection: string) {
// Not yet supported
}
/**
* Set trim of the frame.
* @param trimmed {boolean} Whether this frame trimmed or not.
* @param trimmed {bool} Whether this frame trimmed or not.
* @param actualWidth {number} Actual width of this frame.
* @param actualHeight {number} Actual height of this frame.
* @param destX {number} Destination x position.
@@ -144,7 +144,7 @@ module Phaser {
* @param destWidth {number} Destination draw width.
* @param destHeight {number} Destination draw height.
*/
public setTrim(trimmed: boolean, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number) {
public setTrim(trimmed: bool, actualWidth: number, actualHeight: number, destX: number, destY: number, destWidth: number, destHeight: number) {
//console.log('setTrim', trimmed, 'aw', actualWidth, 'ah', actualHeight, 'dx', destX, 'dy', destY, 'dw', destWidth, 'dh', destHeight);
+2 -2
View File
@@ -94,9 +94,9 @@ module Phaser {
/**
* Check whether there's a frame with given name.
* @param name {string} Name of the frame you want to check.
* @return {boolean} True if frame with given name found, otherwise return false.
* @return {bool} True if frame with given name found, otherwise return false.
*/
public checkFrameName(name: string): boolean {
public checkFrameName(name: string): bool {
if (this._frameNames[name] == null)
{
+7 -7
View File
@@ -61,7 +61,7 @@ module Phaser {
}
private _renderLocal: boolean;
private _renderLocal: bool;
private _canvas: HTMLCanvasElement;
private _target: Sprite = null;
@@ -144,9 +144,9 @@ module Phaser {
public worldBounds: Rectangle = null;
/**
* A boolean representing if the Camera has been modified in any way via a scale, rotate, flip or skew.
* A bool representing if the Camera has been modified in any way via a scale, rotate, flip or skew.
*/
public modified: boolean = false;
public modified: bool = false;
/**
* Sprite moving inside this Rectangle will not cause camera moving.
@@ -156,16 +156,16 @@ module Phaser {
/**
* Whether this camera is visible or not. (default is true)
* @type {boolean}
* @type {bool}
*/
public visible: boolean = true;
public visible: bool = true;
/**
* The z value of this Camera. Cameras are rendered in z-index order by the Renderer.
*/
public z: number = -1;
public set directToStage(value: boolean) {
public set directToStage(value: bool) {
if (value)
{
@@ -201,7 +201,7 @@ module Phaser {
*
* @param object {Sprite/Group} The object to check.
*/
public isHidden(object): boolean {
public isHidden(object): bool {
return object.texture.isHidden(this);
}
+3 -3
View File
@@ -126,9 +126,9 @@ module Phaser {
* Remove a new camera with its id.
*
* @param id {number} ID of the camera you want to remove.
* @returns {boolean} True if successfully removed the camera, otherwise return false.
* @returns {bool} True if successfully removed the camera, otherwise return false.
*/
public removeCamera(id: number): boolean {
public removeCamera(id: number): bool {
for (var c = 0; c < this._cameras.length; c++)
{
@@ -149,7 +149,7 @@ module Phaser {
}
public swap(camera1: Phaser.Camera, camera2: Phaser.Camera, sort: boolean = true): boolean {
public swap(camera1: Phaser.Camera, camera2: Phaser.Camera, sort: bool = true): bool {
if (camera1.ID == camera2.ID)
{
+17 -17
View File
@@ -106,24 +106,24 @@ module Phaser {
public transform;
/**
* A boolean representing if the Group has been modified in any way via a scale, rotate, flip or skew.
* A bool representing if the Group has been modified in any way via a scale, rotate, flip or skew.
*/
public modified: boolean = false;
public modified: bool = false;
/**
* If this Group exists or not. Can be set to false to skip certain loop checks.
*/
public exists: boolean;
public exists: bool;
/**
* If this Group exists or not. Can be set to false to skip certain loop checks.
*/
public active: boolean;
public active: bool;
/**
* Controls if this Group (and all of its contents) are rendered or skipped during the core game loop.
*/
public visible: boolean;
public visible: bool;
/**
* Array of all the objects that exist in this group.
@@ -518,11 +518,11 @@ module Phaser {
* Removes an object from the group.
*
* @param {Basic} object The Game Object you want to remove.
* @param {boolean} splice Whether the object should be cut from the array entirely or not.
* @param {bool} splice Whether the object should be cut from the array entirely or not.
*
* @return {Basic} The removed object.
*/
public remove(object, splice: boolean = false): any {
public remove(object, splice: bool = false): any {
//console.log('removing from group: ', object.name);
@@ -592,7 +592,7 @@ module Phaser {
*
* @return {Basic} True if the two objects successfully swapped position.
*/
public swap(child1, child2, sort: boolean = true): boolean {
public swap(child1, child2, sort: bool = true): bool {
if (child1.group.ID != this.ID || child2.group.ID != this.ID || child1 === child2)
{
@@ -613,7 +613,7 @@ module Phaser {
}
public bringToTop(child): boolean {
public bringToTop(child): bool {
//console.log('bringToTop', child.name,'current z', child.z);
var oldZ = child.z;
@@ -749,9 +749,9 @@ module Phaser {
*
* @param {string} VariableName The string representation of the variable name you want to modify, for example "visible" or "scrollFactor".
* @param {Object} Value The value you want to assign to that variable.
* @param {boolean} Recurse Default value is true, meaning if <code>setAll()</code> encounters a member that is a group, it will call <code>setAll()</code> on that group rather than modifying its variable.
* @param {bool} Recurse Default value is true, meaning if <code>setAll()</code> encounters a member that is a group, it will call <code>setAll()</code> on that group rather than modifying its variable.
*/
public setAll(variableName: string, value: Object, recurse: boolean = true) {
public setAll(variableName: string, value: Object, recurse: bool = true) {
this._i = 0;
@@ -778,9 +778,9 @@ module Phaser {
* Currently only works on functions that have no required parameters.
*
* @param {string} FunctionName The string representation of the function you want to call on each object, for example "kill()" or "init()".
* @param {boolean} Recurse Default value is true, meaning if <code>callAll()</code> encounters a member that is a group, it will call <code>callAll()</code> on that group rather than calling the group's function.
* @param {bool} Recurse Default value is true, meaning if <code>callAll()</code> encounters a member that is a group, it will call <code>callAll()</code> on that group rather than calling the group's function.
*/
public callAll(functionName: string, recurse: boolean = true) {
public callAll(functionName: string, recurse: bool = true) {
this._i = 0;
@@ -804,9 +804,9 @@ module Phaser {
/**
* @param {function} callback
* @param {boolean} recursive
* @param {bool} recursive
*/
public forEach(callback, recursive: boolean = false) {
public forEach(callback, recursive: bool = false) {
this._i = 0;
@@ -832,9 +832,9 @@ module Phaser {
/**
* @param {any} context
* @param {function} callback
* @param {boolean} recursive
* @param {bool} recursive
*/
public forEachAlive(context, callback, recursive: boolean = false) {
public forEachAlive(context, callback, recursive: bool = false) {
this._i = 0;
+9 -9
View File
@@ -39,23 +39,23 @@ module Phaser {
/**
* Controls whether preUpdate, update or postUpdate are called
*/
public active: boolean;
public active: bool;
/**
* Controls whether preRender, render or postRender are called
*/
public visible: boolean;
public visible: bool;
/**
* Quick access booleans to avoid having to do a function existence check during tight inner loops
* Quick access bools to avoid having to do a function existence check during tight inner loops
*/
public hasPreUpdate: boolean;
public hasUpdate: boolean;
public hasPostUpdate: boolean;
public hasPreUpdate: bool;
public hasUpdate: bool;
public hasPostUpdate: bool;
public hasPreRender: boolean;
public hasRender: boolean;
public hasPostRender: boolean;
public hasPreRender: bool;
public hasRender: bool;
public hasPostRender: bool;
/**
* Pre-update is called at the start of the update cycle, before any other updates have taken place.
+1 -1
View File
@@ -53,7 +53,7 @@ module Phaser {
*/
public add(plugin):any {
var result: boolean = false;
var result: bool = false;
// Prototype?
if (typeof plugin === 'function')
+10 -10
View File
@@ -41,22 +41,22 @@ module Phaser {
* If Signal should keep record of previously dispatched parameters and
* automatically execute listener during `add()`/`addOnce()` if Signal was
* already dispatched before.
* @type boolean
* @type bool
*/
public memorize: boolean = false;
public memorize: bool = false;
/**
* @type boolean
* @type bool
* @private
*/
private _shouldPropagate: boolean = true;
private _shouldPropagate: bool = true;
/**
* If Signal is active and should broadcast events.
* <p><strong>IMPORTANT:</strong> Setting this property during a dispatch will only affect the next dispatch, if you want to stop the propagation of a signal use `halt()` instead.</p>
* @type boolean
* @type bool
*/
public active: boolean = true;
public active: bool = true;
/**
*
@@ -75,13 +75,13 @@ module Phaser {
/**
* @param {Function} listener
* @param {boolean} isOnce
* @param {bool} isOnce
* @param {Object} [listenerContext]
* @param {Number} [priority]
* @return {SignalBinding}
* @private
*/
private _registerListener(listener, isOnce: boolean, listenerContext, priority: number): SignalBinding {
private _registerListener(listener, isOnce: bool, listenerContext, priority: number): SignalBinding {
var prevIndex: number = this._indexOfListener(listener, listenerContext);
var binding: SignalBinding;
@@ -159,9 +159,9 @@ module Phaser {
* Check if listener was attached to Signal.
* @param {Function} listener
* @param {Object} [context]
* @return {boolean} if Signal has the specified listener.
* @return {bool} if Signal has the specified listener.
*/
public has(listener, context: any = null): boolean {
public has(listener, context: any = null): bool {
return this._indexOfListener(listener, context) !== -1;
+10 -10
View File
@@ -23,11 +23,11 @@ module Phaser {
* @name SignalBinding
* @param {Signal} signal Reference to Signal object that listener is currently bound to.
* @param {Function} listener Handler function bound to the signal.
* @param {boolean} isOnce If binding should be executed just once.
* @param {bool} isOnce If binding should be executed just once.
* @param {Object} [listenerContext] Context on which listener will be executed (object that should represent the `this` variable inside listener function).
* @param {Number} [priority] The priority level of the event listener. (default = 0).
*/
constructor(signal: Signal, listener, isOnce: boolean, listenerContext, priority: number = 0) {
constructor(signal: Signal, listener, isOnce: bool, listenerContext, priority: number = 0) {
this._listener = listener;
this._isOnce = isOnce;
@@ -46,10 +46,10 @@ module Phaser {
/**
* If binding should be executed just once.
* @type boolean
* @type bool
* @private
*/
private _isOnce: boolean;
private _isOnce: bool;
/**
* Context on which listener will be executed (object that should represent the `this` variable inside listener function).
@@ -74,9 +74,9 @@ module Phaser {
/**
* If binding is active and should be executed.
* @type boolean
* @type bool
*/
public active: boolean = true;
public active: bool = true;
/**
* Default parameters passed to listener during `Signal.dispatch` and `SignalBinding.execute`. (curried parameters)
@@ -123,18 +123,18 @@ module Phaser {
}
/**
* @return {Boolean} `true` if binding is still bound to the signal and have a listener.
* @return {bool} `true` if binding is still bound to the signal and have a listener.
*/
public isBound(): boolean {
public isBound(): bool {
return (!!this._signal && !!this._listener);
}
/**
* @return {boolean} If SignalBinding will only be executed once.
* @return {bool} If SignalBinding will only be executed once.
*/
public isOnce(): boolean {
public isOnce(): bool {
return this._isOnce;
+4 -3
View File
@@ -14,6 +14,7 @@
$defs = file('_definitions.ts');
echo " <ItemGroup>\n";
echo " <TypeScriptCompile Include=\"_definitions.ts\" />\n";
for ($i = 0; $i < count($defs); $i++)
{
@@ -46,9 +47,9 @@
*/
echo " <TypeScriptCompile Include=\"$ts\" />\n";
echo " <Content Include=\"$js\">\n";
echo " <DependentUpon>$file</DependentUpon>\n";
echo " </Content>\n";
//echo " <Content Include=\"$js\">\n";
//echo " <DependentUpon>$file</DependentUpon>\n";
//echo " </Content>\n";
}
}
+1 -1
View File
@@ -241,7 +241,7 @@ module Phaser.Display {
}
// TODO - Add in support for: alphaBitmapData: BitmapData = null, alphaPoint: Point = null, mergeAlpha: boolean = false
// TODO - Add in support for: alphaBitmapData: BitmapData = null, alphaPoint: Point = null, mergeAlpha: bool = false
/**
* Copy pixel from another DynamicTexture to this texture.
* @param sourceTexture {DynamicTexture} Source texture object.
+16 -16
View File
@@ -72,9 +72,9 @@ module Phaser.Display {
/**
* The load status of the texture image.
* @type {boolean}
* @type {bool}
*/
public loaded: boolean = false;
public loaded: bool = false;
/**
* An Array of Cameras to which this texture won't render
@@ -86,9 +86,9 @@ module Phaser.Display {
* Whether the texture background is opaque or not. If set to true the object is filled with
* the value of Texture.backgroundColor every frame. Normally you wouldn't enable this but
* for some effects it can be handy.
* @type {boolean}
* @type {bool}
*/
public opaque: boolean = false;
public opaque: bool = false;
/**
* Opacity of the Sprite texture where 1 is opaque (default) and 0 is fully transparent.
@@ -136,9 +136,9 @@ module Phaser.Display {
/**
* Controls if the Sprite is rendered rotated or not.
* If renderRotation is false then the object can still rotate but it will never be rendered rotated.
* @type {boolean}
* @type {bool}
*/
public renderRotation: boolean = true;
public renderRotation: bool = true;
/**
* The direction the animation frame is facing (can be Phaser.Types.RIGHT, LEFT, UP, DOWN).
@@ -148,21 +148,21 @@ module Phaser.Display {
/**
* Flip the graphic horizontally (defaults to false)
* @type {boolean}
* @type {bool}
*/
public flippedX: boolean = false;
public flippedX: bool = false;
/**
* Flip the graphic vertically (defaults to false)
* @type {boolean}
* @type {bool}
*/
public flippedY: boolean = false;
public flippedY: bool = false;
/**
* Is the texture a DynamicTexture?
* @type {boolean}
* @type {bool}
*/
public isDynamic: boolean = false;
public isDynamic: bool = false;
/**
* The crop rectangle allows you to control which part of the sprite texture is rendered without distorting it.
@@ -189,7 +189,7 @@ module Phaser.Display {
/**
* Returns true if this texture is hidden from rendering to the given camera, otherwise false.
*/
public isHidden(camera: Phaser.Camera): boolean {
public isHidden(camera: Phaser.Camera): bool {
if (this._blacklist && this.cameraBlacklist.indexOf(camera.ID) !== -1)
{
@@ -247,10 +247,10 @@ module Phaser.Display {
* Sets a new graphic from the game cache to use as the texture for this Sprite.
* The graphic can be SpriteSheet or Texture Atlas. If you need to use a DynamicTexture see loadDynamicTexture.
* @param key {string} Key of the graphic you want to load for this sprite.
* @param clearAnimations {boolean} If this Sprite has a set of animation data already loaded you can choose to keep or clear it with this boolean
* @param updateBody {boolean} Update the physics body dimensions to match the newly loaded texture/frame?
* @param clearAnimations {bool} If this Sprite has a set of animation data already loaded you can choose to keep or clear it with this bool
* @param updateBody {bool} Update the physics body dimensions to match the newly loaded texture/frame?
*/
public loadImage(key: string, clearAnimations: boolean = true, updateBody: boolean = true) {
public loadImage(key: string, clearAnimations: bool = true, updateBody: bool = true) {
if (clearAnimations && this.parent['animations'] && this.parent['animations'].frameData !== null)
{
+4 -21
View File
@@ -85,11 +85,10 @@ module Phaser {
return <Phaser.Sprite> this._world.group.add(new Phaser.Sprite(this.game, x, y, key, frame));
}
public audio(key: string, volume: number = 1, loop: boolean = false): Phaser.Sound {
public audio(key: string, volume: number = 1, loop: bool = false): Phaser.Sound {
return <Phaser.Sound> this.game.sound.add(key, volume, loop);
}
/*
public circle(x: number, y: number, radius: number): Phaser.Physics.Circle {
return new Phaser.Physics.Circle(this.game, x, y, radius);
}
@@ -101,22 +100,6 @@ module Phaser {
public cell(x: number, y: number, width: number, height: number, state: number = Phaser.Physics.TileMapCell.TID_FULL): Phaser.Physics.TileMapCell {
return new Phaser.Physics.TileMapCell(this.game, x, y, width, height).SetState(state);
}
*/
/**
* Create a new Sprite with the physics automatically created and set to DYNAMIC. The Sprite position offset is set to its center.
*
* @param x {number} X position of the new sprite.
* @param y {number} Y position of the new sprite.
* @param [key] {string} The image key as defined in the Game.Cache to use as the texture for this sprite
* @param [frame] {string|number} If the sprite uses an image from a texture atlas or sprite sheet you can pass the frame here. Either a number for a frame ID or a string for a frame name.
* @param [bodyType] {number} The physics body type of the object (defaults to BODY_DYNAMIC)
* @param [shapeType] The default body shape is either 0 for a Box or 1 for a Circle. See Sprite.body.addShape for custom shapes (polygons, etc)
* @returns {Sprite} The newly created sprite object.
*/
//public physicsSprite(x: number, y: number, key: string = '', frame? = null, bodyType: number = Phaser.Types.BODY_DYNAMIC, shapeType:number = 0): Sprite {
// return <Sprite> this._world.group.add(new Sprite(this.game, x, y, key, frame, bodyType, shapeType));
//}
/**
* Create a new DynamicTexture with specific size.
@@ -180,12 +163,12 @@ module Phaser {
* @param key {string} Key for tileset image.
* @param mapData {string} Data of this tilemap.
* @param format {number} Format of map data. (Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON)
* @param [resizeWorld] {boolean} resize the world to make same as tilemap?
* @param [resizeWorld] {bool} resize the world to make same as tilemap?
* @param [tileWidth] {number} width of each tile.
* @param [tileHeight] {number} height of each tile.
* @return {Tilemap} The newly created tilemap object.
*/
public tilemap(key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0): Phaser.Tilemap {
public tilemap(key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth: number = 0, tileHeight: number = 0): Phaser.Tilemap {
return <Phaser.Tilemap> this._world.group.add(new Phaser.Tilemap(this.game, key, mapData, format, resizeWorld, tileWidth, tileHeight));
}
@@ -196,7 +179,7 @@ module Phaser {
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
* @return {Phaser.Tween} The newly created tween object.
*/
public tween(obj, localReference: boolean = false): Phaser.Tween {
public tween(obj, localReference: bool = false): Phaser.Tween {
return this.game.tweens.create(obj, localReference);
}
+4 -3
View File
@@ -42,17 +42,17 @@ module Phaser {
/**
* Controls if both <code>update</code> and render are called by the core game loop.
*/
exists: boolean;
exists: bool;
/**
* Controls if <code>update()</code> is automatically called by the core game loop.
*/
active: boolean;
active: bool;
/**
* Controls if this is rendered or skipped during the core game loop.
*/
visible: boolean;
visible: bool;
/**
* The animation manager component
@@ -78,6 +78,7 @@ module Phaser {
* The transform component.
*/
transform: Phaser.Components.TransformManager;
//transform;
}
+2 -2
View File
@@ -50,9 +50,9 @@ module Phaser {
/**
* Will this region be rendered? (default to true)
* @type {boolean}
* @type {bool}
*/
public visible: boolean = true;
public visible: bool = true;
/**
* Region scrolling speed.
+12 -11
View File
@@ -64,7 +64,7 @@ module Phaser {
this.transform.setCache();
//this.body = new Phaser.Physics.Body(this, 0);
this.body = new Phaser.Physics.Body(this, 0);
this.outOfBounds = false;
this.outOfBoundsAction = Phaser.Types.OUT_OF_BOUNDS_PERSIST;
@@ -100,27 +100,27 @@ module Phaser {
/**
* Controls if both <code>update</code> and render are called by the core game loop.
*/
public exists: boolean;
public exists: bool;
/**
* Controls if <code>update()</code> is automatically called by the core game loop.
*/
public active: boolean;
public active: bool;
/**
* Controls if this Sprite is rendered or skipped during the core game loop.
*/
public visible: boolean;
public visible: bool;
/**
* A useful state for many game objects. Kill and revive both flip this switch.
*/
public alive: boolean;
public alive: bool;
/**
* Is the Sprite out of the world bounds or not?
*/
public outOfBounds: boolean;
public outOfBounds: bool;
/**
* The action to be taken when the sprite is fully out of the world bounds
@@ -151,8 +151,7 @@ module Phaser {
/**
* The Physics Body
*/
//public body: Phaser.Physics.Body;
public body;
public body: Phaser.Physics.Body;
/**
* This manages animations of the sprite. You can modify animations through it. (see AnimationManager)
@@ -178,9 +177,9 @@ module Phaser {
public tween: Phaser.Tween;
/**
* A boolean representing if the Sprite has been modified in any way via a scale, rotate, flip or skew.
* A bool representing if the Sprite has been modified in any way via a scale, rotate, flip or skew.
*/
public modified: boolean = false;
public modified: bool = false;
/**
* x value of the object.
@@ -364,6 +363,8 @@ module Phaser {
this.checkBounds();
this.transform.centerOn(this.body.aabb.pos.x, this.body.aabb.pos.y);
if (this.modified == true && this.transform.scale.equals(1) && this.transform.skew.equals(0) && this.transform.rotation == 0 && this.transform.rotationOffset == 0 && this.texture.flippedX == false && this.texture.flippedY == false)
{
this.modified = false;
@@ -414,7 +415,7 @@ module Phaser {
* like to animate an effect or whatever, you should override this,
* setting only alive to false, and leaving exists true.
*/
public kill(removeFromGroup:boolean = false) {
public kill(removeFromGroup:bool = false) {
this.alive = false;
this.exists = false;
+3 -3
View File
@@ -43,7 +43,7 @@ module Phaser.Components {
private _rotation: number;
private _dirty: boolean = false;
private _dirty: bool = false;
// Cache vars
private _pos: Phaser.Point;
@@ -57,8 +57,8 @@ module Phaser.Components {
private _angle: number;
private _distance: number;
private _prevRotation: number;
private _flippedX: boolean;
private _flippedY: boolean;
private _flippedX: bool;
private _flippedY: bool;
/**
* Reference to Phaser.Game
+3 -3
View File
@@ -261,9 +261,9 @@ module Phaser {
/**
* Determines whether or not this Circle object is empty.
* @method empty
* @return {Boolean} A value of true if the Circle objects diameter is less than or equal to 0; otherwise false.
* @return {bool} A value of true if the Circle objects diameter is less than or equal to 0; otherwise false.
**/
get empty(): boolean {
get empty(): bool {
return (this._diameter == 0);
}
@@ -272,7 +272,7 @@ module Phaser {
* @method setEmpty
* @return {Circle} This Circle object
**/
set empty(value: boolean) {
set empty(value: bool) {
this.setTo(0, 0, 0);
}
+7 -5
View File
@@ -193,9 +193,9 @@ module Phaser {
* @method isPointOnLine
* @param {Number} x
* @param {Number} y
* @return {Boolean}
* @return {bool}
*/
public isPointOnLine(x: number, y: number): boolean {
public isPointOnLine(x: number, y: number): bool {
if ((x - this.x1) * (this.y2 - this.y1) === (this.x2 - this.x1) * (y - this.y1))
{
@@ -213,9 +213,9 @@ module Phaser {
* @method isPointOnLineSegment
* @param {Number} x
* @param {Number} y
* @return {Boolean}
* @return {bool}
*/
public isPointOnLineSegment(x: number, y: number): boolean {
public isPointOnLineSegment(x: number, y: number): bool {
var xMin = Math.min(this.x1, this.x2);
var xMax = Math.max(this.x1, this.x2);
@@ -251,6 +251,7 @@ module Phaser {
* @param {Phaser.Line} [output]
* @return {Phaser.Line}
*/
/*
public perp(x: number, y: number, output: Line): Line {
if (this.y1 === this.y2)
@@ -267,7 +268,7 @@ module Phaser {
var yInt: number = (y - this.perpSlope * x);
var pt: any = this.intersectLineLine({ x1: x, y1: y, x2: 0, y2: yInt });
var pt = this.intersectLineLine({ x1: x, y1: y, x2: 0, y2: yInt });
if (output)
{
@@ -279,6 +280,7 @@ module Phaser {
}
}
*/
/*
intersectLineCircle (circle:Circle)
+3 -3
View File
@@ -239,9 +239,9 @@ module Phaser {
/**
* Determines whether or not this Rectangle object is empty.
* @method isEmpty
* @return {Boolean} A value of true if the Rectangle objects width or height is less than or equal to 0; otherwise false.
* @return {bool} A value of true if the Rectangle objects width or height is less than or equal to 0; otherwise false.
**/
get empty(): boolean {
get empty(): bool {
return (!this.width || !this.height);
}
@@ -250,7 +250,7 @@ module Phaser {
* @method setEmpty
* @return {Rectangle} This Rectangle object
**/
set empty(value: boolean) {
set empty(value: bool) {
this.setTo(0, 0, 0, 0);
}
+46 -46
View File
@@ -36,9 +36,9 @@ module Phaser.Components {
/**
* If enabled the Input component will be updated by the parent Sprite
* @type {Boolean}
* @type {bool}
*/
public enabled: boolean;
public enabled: bool;
/**
* The PriorityID controls which Sprite receives an Input event first if they should overlap.
@@ -53,17 +53,17 @@ module Phaser.Components {
private _dragPoint: Point;
private _draggedPointerID: number;
public dragOffset: Point;
public isDragged: boolean = false;
public dragFromCenter: boolean;
public dragPixelPerfect: boolean = false;
public isDragged: bool = false;
public dragFromCenter: bool;
public dragPixelPerfect: bool = false;
public dragPixelPerfectAlpha: number;
public allowHorizontalDrag: boolean = true;
public allowVerticalDrag: boolean = true;
public bringToTop: boolean = false;
public allowHorizontalDrag: bool = true;
public allowVerticalDrag: bool = true;
public bringToTop: bool = false;
public snapOnDrag: boolean = false;
public snapOnRelease: boolean = false;
public snapOnDrag: bool = false;
public snapOnRelease: bool = false;
public snapOffset: Point;
public snapX: number = 0;
public snapY: number = 0;
@@ -73,7 +73,7 @@ module Phaser.Components {
* Is this sprite allowed to be dragged by the mouse? true = yes, false = no
* @default false
*/
public draggable: boolean = false;
public draggable: bool = false;
/**
* A region of the game world within which the sprite is restricted during drag
@@ -90,23 +90,23 @@ module Phaser.Components {
/**
* The Input component can monitor either the physics body of the Sprite or the frameBounds
* If checkBody is set to true it will monitor the bounds of the physics body.
* @type {Boolean}
* @type {bool}
*/
public checkBody: boolean;
public checkBody: bool;
/**
* Turn the mouse pointer into a hand image by temporarily setting the CSS style of the Game canvas
* on Input over. Only works on desktop browsers or browsers with a visible input pointer.
* @type {Boolean}
* @type {bool}
*/
public useHandCursor: boolean;
public useHandCursor: bool;
/**
* If this object is set to consume the pointer event then it will stop all propogation from this object on.
* For example if you had a stack of 6 sprites with the same priority IDs and one consumed the event, none of the others would receive it.
* @type {Boolean}
* @type {bool}
*/
public consumePointerEvent: boolean = false;
public consumePointerEvent: bool = false;
/**
* The x coordinate of the Input pointer, relative to the top-left of the parent Sprite.
@@ -129,18 +129,18 @@ module Phaser.Components {
/**
* If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true
* @property isDown
* @type {Boolean}
* @type {bool}
**/
public pointerDown(pointer: number = 0): boolean {
public pointerDown(pointer: number = 0): bool {
return this._pointerData[pointer].isDown;
}
/**
* If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true
* @property isUp
* @type {Boolean}
* @type {bool}
**/
public pointerUp(pointer: number = 0): boolean {
public pointerUp(pointer: number = 0): bool {
return this._pointerData[pointer].isUp;
}
@@ -149,7 +149,7 @@ module Phaser.Components {
* @property timeDown
* @type {Number}
**/
public pointerTimeDown(pointer: number = 0): boolean {
public pointerTimeDown(pointer: number = 0): bool {
return this._pointerData[pointer].timeDown;
}
@@ -158,25 +158,25 @@ module Phaser.Components {
* @property timeUp
* @type {Number}
**/
public pointerTimeUp(pointer: number = 0): boolean {
public pointerTimeUp(pointer: number = 0): bool {
return this._pointerData[pointer].timeUp;
}
/**
* Is the Pointer over this Sprite
* @property isOver
* @type {Boolean}
* @type {bool}
**/
public pointerOver(pointer: number = 0): boolean {
public pointerOver(pointer: number = 0): bool {
return this._pointerData[pointer].isOver;
}
/**
* Is the Pointer outside of this Sprite
* @property isOut
* @type {Boolean}
* @type {bool}
**/
public pointerOut(pointer: number = 0): boolean {
public pointerOut(pointer: number = 0): bool {
return this._pointerData[pointer].isOut;
}
@@ -185,7 +185,7 @@ module Phaser.Components {
* @property timeDown
* @type {Number}
**/
public pointerTimeOver(pointer: number = 0): boolean {
public pointerTimeOver(pointer: number = 0): bool {
return this._pointerData[pointer].timeOver;
}
@@ -194,7 +194,7 @@ module Phaser.Components {
* @property timeUp
* @type {Number}
**/
public pointerTimeOut(pointer: number = 0): boolean {
public pointerTimeOut(pointer: number = 0): bool {
return this._pointerData[pointer].timeOut;
}
@@ -202,11 +202,11 @@ module Phaser.Components {
* Is this sprite being dragged by the mouse or not?
* @default false
*/
public pointerDragged(pointer: number = 0): boolean {
public pointerDragged(pointer: number = 0): bool {
return this._pointerData[pointer].isDragged;
}
public start(priority: number = 0, checkBody: boolean = false, useHandCursor: boolean = false): Phaser.Sprite {
public start(priority: number = 0, checkBody: bool = false, useHandCursor: bool = false): Phaser.Sprite {
// Turning on
if (this.enabled == false)
@@ -287,7 +287,7 @@ module Phaser.Components {
/**
* Checks if the given pointer is over this Sprite. All checks are done in world coordinates.
*/
public checkPointerOver(pointer: Phaser.Pointer): boolean {
public checkPointerOver(pointer: Phaser.Pointer): bool {
if (this.enabled == false || this._parent.visible == false)
{
@@ -303,7 +303,7 @@ module Phaser.Components {
/**
* Update
*/
public update(pointer: Phaser.Pointer): boolean {
public update(pointer: Phaser.Pointer): bool {
if (this.enabled == false || this._parent.visible == false)
{
@@ -367,7 +367,7 @@ module Phaser.Components {
}
public _touchedHandler(pointer: Pointer): boolean {
public _touchedHandler(pointer: Pointer): bool {
if (this._pointerData[pointer.id].isDown == false && this._pointerData[pointer.id].isOver == true)
{
@@ -436,7 +436,7 @@ module Phaser.Components {
/**
* Updates the Pointer drag on this Sprite.
*/
private updateDrag(pointer: Pointer): boolean {
private updateDrag(pointer: Pointer): bool {
if (pointer.isUp)
{
@@ -476,36 +476,36 @@ module Phaser.Components {
/**
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
* @param delay The time below which the pointer is considered as just over.
* @returns {boolean}
* @returns {bool}
*/
public justOver(pointer: number = 0, delay: number = 500): boolean {
public justOver(pointer: number = 0, delay: number = 500): bool {
return (this._pointerData[pointer].isOver && this.overDuration(pointer) < delay);
}
/**
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
* @param delay The time below which the pointer is considered as just out.
* @returns {boolean}
* @returns {bool}
*/
public justOut(pointer: number = 0, delay: number = 500): boolean {
public justOut(pointer: number = 0, delay: number = 500): bool {
return (this._pointerData[pointer].isOut && (this.game.time.now - this._pointerData[pointer].timeOut < delay));
}
/**
* Returns true if the pointer has entered the Sprite within the specified delay time (defaults to 500ms, half a second)
* @param delay The time below which the pointer is considered as just over.
* @returns {boolean}
* @returns {bool}
*/
public justPressed(pointer: number = 0, delay: number = 500): boolean {
public justPressed(pointer: number = 0, delay: number = 500): bool {
return (this._pointerData[pointer].isDown && this.downDuration(pointer) < delay);
}
/**
* Returns true if the pointer has left the Sprite within the specified delay time (defaults to 500ms, half a second)
* @param delay The time below which the pointer is considered as just out.
* @returns {boolean}
* @returns {bool}
*/
public justReleased(pointer: number = 0, delay: number = 500): boolean {
public justReleased(pointer: number = 0, delay: number = 500): bool {
return (this._pointerData[pointer].isUp && (this.game.time.now - this._pointerData[pointer].timeUp < delay));
}
@@ -549,7 +549,7 @@ module Phaser.Components {
* @param boundsRect If you want to restrict the drag of this sprite to a specific FlxRect, pass the FlxRect here, otherwise it's free to drag anywhere
* @param boundsSprite If you want to restrict the drag of this sprite to within the bounding box of another sprite, pass it here
*/
public enableDrag(lockCenter: boolean = false, bringToTop: boolean = false, pixelPerfect: boolean = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null) {
public enableDrag(lockCenter: bool = false, bringToTop: bool = false, pixelPerfect: bool = false, alphaThreshold: number = 255, boundsRect: Rectangle = null, boundsSprite: Phaser.Sprite = null) {
this._dragPoint = new Point;
@@ -648,7 +648,7 @@ module Phaser.Components {
* @param allowHorizontal To enable the sprite to be dragged horizontally set to true, otherwise false
* @param allowVertical To enable the sprite to be dragged vertically set to true, otherwise false
*/
public setDragLock(allowHorizontal: boolean = true, allowVertical: boolean = true) {
public setDragLock(allowHorizontal: bool = true, allowVertical: bool = true) {
this.allowHorizontalDrag = allowHorizontal;
this.allowVerticalDrag = allowVertical;
}
@@ -662,7 +662,7 @@ module Phaser.Components {
* @param onDrag If true the sprite will snap to the grid while being dragged
* @param onRelease If true the sprite will snap to the grid when released
*/
public enableSnap(snapX: number, snapY: number, onDrag: boolean = true, onRelease: boolean = false) {
public enableSnap(snapX: number, snapY: number, onDrag: bool = true, onRelease: bool = false) {
this.snapOnDrag = onDrag;
this.snapOnRelease = onRelease;
this.snapX = snapX;
+11 -11
View File
@@ -96,9 +96,9 @@ module Phaser {
/**
* You can disable all Input by setting Input.disabled = true. While set all new input related events will be ignored.
* If you need to disable just one type of input, for example mouse, use Input.mouse.disabled = true instead
* @type {Boolean}
* @type {bool}
*/
public disabled: boolean = false;
public disabled: bool = false;
/**
* Controls the expected behaviour when using a mouse and touch together on a multi-input device
@@ -221,7 +221,7 @@ module Phaser {
/**
* A Signal dispatched when a Pointer object (including the mouse) is tapped: pressed and released quickly.
* The signal sends 2 parameters. The Pointer that caused it and a boolean depending if the tap was a single tap or a double tap.
* The signal sends 2 parameters. The Pointer that caused it and a bool depending if the tap was a single tap or a double tap.
* @type {Phaser.Signal}
*/
public onTap: Phaser.Signal;
@@ -272,9 +272,9 @@ module Phaser {
* The history is cleared each time the Pointer is pressed down.
* The history is updated at the rate specified in Input.pollRate
* @property recordPointerHistory
* @type {Boolean}
* @type {bool}
**/
public recordPointerHistory: boolean = false;
public recordPointerHistory: bool = false;
/**
* The rate in milliseconds at which the Pointer objects should update their tracking history
@@ -495,7 +495,7 @@ module Phaser {
}
public get pollLocked(): boolean {
public get pollLocked(): bool {
return (this.pollRate > 0 && this._pollCounter < this.pollRate);
}
@@ -536,9 +536,9 @@ module Phaser {
/**
* Reset all of the Pointers and Input states
* @method reset
* @param hard {Boolean} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
* @param hard {bool} A soft reset (hard = false) won't reset any signals that might be bound. A hard reset will.
**/
public reset(hard: boolean = false) {
public reset(hard: bool = false) {
this.keyboard.reset();
@@ -725,10 +725,10 @@ module Phaser {
/**
* Get the next Pointer object whos active property matches the given state
* @method getPointer
* @param {Boolean} state The state the Pointer should be in (false for inactive, true for active)
* @param {bool} state The state the Pointer should be in (false for inactive, true for active)
* @return {Pointer} A Pointer object or null if no Pointer object matches the requested state.
**/
public getPointer(state: boolean = false): Pointer {
public getPointer(state: bool = false): Pointer {
// Unrolled for speed
if (this.pointer1.active == state)
@@ -827,7 +827,7 @@ module Phaser {
return Vec2Utils.angle(pointer1.position, pointer2.position);
}
public pixelPerfectCheck(sprite: Phaser.Sprite, pointer: Phaser.Pointer, alpha: number = 255): boolean {
public pixelPerfectCheck(sprite: Phaser.Sprite, pointer: Phaser.Pointer, alpha: number = 255): bool {
this.hitContext.clearRect(0, 0, 1, 1);
+8 -8
View File
@@ -30,9 +30,9 @@ module Phaser {
/**
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
* @type {Boolean}
* @type {bool}
*/
public disabled: boolean = false;
public disabled: bool = false;
/**
* A reference to the event handlers to allow removeEventListener support
@@ -161,9 +161,9 @@ module Phaser {
/**
* @param {Number} keycode
* @param {Number} [duration]
* @return {Boolean}
* @return {bool}
*/
public justPressed(keycode: number, duration: number = 250): boolean {
public justPressed(keycode: number, duration: number = 250): bool {
if (this._keys[keycode] && this._keys[keycode].isDown === true && (this.game.time.now - this._keys[keycode].timeDown < duration))
{
@@ -179,9 +179,9 @@ module Phaser {
/**
* @param {Number} keycode
* @param {Number} [duration]
* @return {Boolean}
* @return {bool}
*/
public justReleased(keycode: number, duration: number = 250): boolean {
public justReleased(keycode: number, duration: number = 250): bool {
if (this._keys[keycode] && this._keys[keycode].isDown === false && (this.game.time.now - this._keys[keycode].timeUp < duration))
{
@@ -196,9 +196,9 @@ module Phaser {
/**
* @param {Number} keycode
* @return {Boolean}
* @return {bool}
*/
public isDown(keycode: number): boolean {
public isDown(keycode: number): bool {
if (this._keys[keycode])
{
+2 -2
View File
@@ -32,9 +32,9 @@ module Phaser {
/**
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
* @type {Boolean}
* @type {bool}
*/
public disabled: boolean = false;
public disabled: bool = false;
/**
* A reference to the event handlers to allow removeEventListener support
+2 -2
View File
@@ -30,9 +30,9 @@ module Phaser {
/**
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
* @type {Boolean}
* @type {bool}
*/
public disabled: boolean = false;
public disabled: bool = false;
/**
* Custom callback useful for hooking into a 3rd party library. Will be passed the mouse event as the only parameter.
+17 -17
View File
@@ -47,10 +47,10 @@ module Phaser {
/**
* Local private variable to store the status of dispatching a hold event
* @property _holdSent
* @type {Boolean}
* @type {bool}
* @private
*/
private _holdSent: boolean = false;
private _holdSent: bool = false;
/**
* Local private variable storing the short-term history of pointer movements
@@ -69,7 +69,7 @@ module Phaser {
private _nextDrop: number = 0;
// Monitor events outside of a state reset loop
private _stateReset: boolean = false;
private _stateReset: bool = false;
/**
* The Pointer ID (a number between 1 and 10, 0 is reserved for the mouse pointer specifically)
@@ -90,9 +90,9 @@ module Phaser {
/**
* Is this Pointer active or not? An active Pointer is one that is in contact with the touch screen.
* @property active
* @type {Boolean}
* @type {bool}
*/
public active: boolean;
public active: bool;
/**
* A Vector object containing the initial position when the Pointer was engaged with the screen.
@@ -119,9 +119,9 @@ module Phaser {
/**
*
* @property withinGame
* @type {Boolean}
* @type {bool}
*/
public withinGame: boolean = false;
public withinGame: bool = false;
/**
* If this Pointer is a mouse the button property holds the value of which mouse button was pressed down
@@ -196,23 +196,23 @@ module Phaser {
/**
* If the Pointer is a mouse this is true, otherwise false
* @property isMouse
* @type {Boolean}
* @type {bool}
**/
public isMouse: boolean = false;
public isMouse: bool = false;
/**
* If the Pointer is touching the touchscreen, or the mouse button is held down, isDown is set to true
* @property isDown
* @type {Boolean}
* @type {bool}
**/
public isDown: boolean = false;
public isDown: bool = false;
/**
* If the Pointer is not touching the touchscreen, or the mouse button is up, isUp is set to true
* @property isUp
* @type {Boolean}
* @type {bool}
**/
public isUp: boolean = true;
public isUp: bool = true;
/**
* A timestamp representing when the Pointer first touched the touchscreen.
@@ -620,9 +620,9 @@ module Phaser {
* The Pointer is considered justPressed if the time it was pressed onto the touchscreen or clicked is less than justPressedRate
* @method justPressed
* @param {Number} [duration].
* @return {Boolean}
* @return {bool}
*/
public justPressed(duration: number = this.game.input.justPressedRate): boolean {
public justPressed(duration: number = this.game.input.justPressedRate): bool {
if (this.isDown === true && (this.timeDown + duration) > this.game.time.now)
{
@@ -639,9 +639,9 @@ module Phaser {
* The Pointer is considered justReleased if the time it left the touchscreen is less than justReleasedRate
* @method justReleased
* @param {Number} [duration].
* @return {Boolean}
* @return {bool}
*/
public justReleased(duration: number = this.game.input.justReleasedRate): boolean {
public justReleased(duration: number = this.game.input.justReleasedRate): bool {
if (this.isUp === true && (this.timeUp + duration) > this.game.time.now)
{
+2 -2
View File
@@ -35,9 +35,9 @@ module Phaser {
/**
* You can disable all Input by setting disabled = true. While set all new input related events will be ignored.
* @type {Boolean}
* @type {bool}
*/
public disabled: boolean = false;
public disabled: bool = false;
/**
* Custom callback useful for hooking into a 3rd party library. Will be passed the touch event as the only parameter.
+6 -6
View File
@@ -122,10 +122,10 @@ module Phaser {
* @param url {string} URL of this sound file.
* @param data {object} Extra sound data.
*/
public addSound(key: string, url: string, data, webAudio: boolean = true, audioTag: boolean = false) {
public addSound(key: string, url: string, data, webAudio: bool = true, audioTag: bool = false) {
var locked: boolean = this.game.sound.touchLocked;
var decoded: boolean = false;
var locked: bool = this.game.sound.touchLocked;
var decoded: bool = false;
if (audioTag) {
decoded = true;
@@ -277,7 +277,7 @@ module Phaser {
* @param key Asset key of the sound you want.
* @return {object} The sound data you want.
*/
public isSoundDecoded(key: string): boolean {
public isSoundDecoded(key: string): bool {
if (this._sounds[key])
{
@@ -291,7 +291,7 @@ module Phaser {
* @param key Asset key of the sound you want.
* @return {object} The sound data you want.
*/
public isSoundReady(key: string): boolean {
public isSoundReady(key: string): bool {
if (this._sounds[key] && this._sounds[key].decoded == true && this._sounds[key].locked == false)
{
@@ -307,7 +307,7 @@ module Phaser {
* @param key Asset key of the sprite sheet you want.
* @return {object} The sprite sheet data you want.
*/
public isSpriteSheet(key: string): boolean {
public isSpriteSheet(key: string): bool {
if (this._images[key])
{
+12 -12
View File
@@ -64,15 +64,15 @@ module Phaser {
/**
* True if the Loader is in the process of loading a queue.
* @type {boolean}
* @type {bool}
*/
public isLoading: boolean;
public isLoading: bool;
/**
* True if game is completely loaded.
* @type {boolean}
* @type {bool}
*/
public hasLoaded: boolean;
public hasLoaded: bool;
/**
* Loading progress (from 0 to 100)
@@ -120,7 +120,7 @@ module Phaser {
* @param key {string} Unique asset key of this image file.
* @param url {string} URL of image file.
*/
public image(key: string, url: string, overwrite: boolean = false) {
public image(key: string, url: string, overwrite: bool = false) {
if (overwrite == true || this.checkKeyExists(key) == false)
{
@@ -234,9 +234,9 @@ module Phaser {
* Add a new audio file loading request.
* @param key {string} Unique asset key of the audio file.
* @param urls {Array} An array containing the URLs of the audio files, i.e.: [ 'jump.mp3', 'jump.ogg', 'jump.m4a' ]
* @param autoDecode {boolean} When using Web Audio the audio files can either be decoded at load time or run-time. They can't be played until they are decoded, but this let's you control when that happens. Decoding is a non-blocking async process.
* @param autoDecode {bool} When using Web Audio the audio files can either be decoded at load time or run-time. They can't be played until they are decoded, but this let's you control when that happens. Decoding is a non-blocking async process.
*/
public audio(key: string, urls: string[], autoDecode: boolean = true) {
public audio(key: string, urls: string[], autoDecode: bool = true) {
if (this.checkKeyExists(key) === false)
{
@@ -438,7 +438,7 @@ module Phaser {
this._fileList[key].loaded = true;
var file = this._fileList[key];
var loadNext: boolean = true;
var loadNext: bool = true;
switch (file.type)
{
@@ -589,9 +589,9 @@ module Phaser {
/**
* Handle loading next file.
* @param previousKey {string} Key of previous loaded asset.
* @param success {boolean} Whether the previous asset loaded successfully or not.
* @param success {bool} Whether the previous asset loaded successfully or not.
*/
private nextFile(previousKey: string, success: boolean) {
private nextFile(previousKey: string, success: bool) {
this.progress = Math.round(this.progress + this._progressChunk);
@@ -621,9 +621,9 @@ module Phaser {
/**
* Check whether asset exists with a specific key.
* @param key {string} Key of the asset you want to check.
* @return {boolean} Return true if exists, otherwise return false.
* @return {bool} Return true if exists, otherwise return false.
*/
private checkKeyExists(key: string): boolean {
private checkKeyExists(key: string): bool {
if (this._fileList[key])
{
+17 -17
View File
@@ -65,8 +65,8 @@ module Phaser {
static CIRCLE_ALPHA: number = 0.5522847498307933984022516322796; //4*(Math.sqrt(2)-1)/3.0;
static ON: boolean = true;
static OFF: boolean = false;
static ON: bool = true;
static OFF: bool = false;
static SHORT_EPSILON: number = 0.1;//round integer epsilon
static PERC_EPSILON: number = 0.001;//percentage epsilon
@@ -76,15 +76,15 @@ module Phaser {
public cosTable = [];
public sinTable = [];
public fuzzyEqual(a: number, b: number, epsilon: number = 0.0001): boolean {
public fuzzyEqual(a: number, b: number, epsilon: number = 0.0001): bool {
return Math.abs(a - b) < epsilon;
}
public fuzzyLessThan(a: number, b: number, epsilon: number = 0.0001): boolean {
public fuzzyLessThan(a: number, b: number, epsilon: number = 0.0001): bool {
return a < b + epsilon;
}
public fuzzyGreaterThan(a: number, b: number, epsilon: number = 0.0001): boolean {
public fuzzyGreaterThan(a: number, b: number, epsilon: number = 0.0001): bool {
return a > b - epsilon;
}
@@ -226,7 +226,7 @@ module Phaser {
/**
* Snaps a value to the nearest value in an array.
*/
public snapToInArray(input: number, arr: number[], sort: boolean = true): number {
public snapToInArray(input: number, arr: number[], sort: bool = true): number {
if (sort) arr.sort();
if (input < arr[0]) return arr[0];
@@ -325,7 +325,7 @@ module Phaser {
/**
* set an angle within the bounds of -PI to PI
*/
public normalizeAngle(angle: number, radians: boolean = true): number {
public normalizeAngle(angle: number, radians: bool = true): number {
var rd: number = (radians) ? GameMath.PI : 180;
return this.wrap(angle, rd, -rd);
}
@@ -334,7 +334,7 @@ module Phaser {
* closest angle between two angles from a1 to a2
* absolute value the return for exact angle
*/
public nearestAngleBetween(a1: number, a2: number, radians: boolean = true): number {
public nearestAngleBetween(a1: number, a2: number, radians: bool = true): number {
var rd: number = (radians) ? GameMath.PI : 180;
@@ -352,7 +352,7 @@ module Phaser {
*
* for instance if dep=-170 and ind=170 then 190 will be returned as an alternative to -170
*/
public normalizeAngleToAnother(dep: number, ind: number, radians: boolean = true): number {
public normalizeAngleToAnother(dep: number, ind: number, radians: bool = true): number {
return ind + this.nearestAngleBetween(ind, dep, radians);
}
@@ -361,7 +361,7 @@ module Phaser {
*
* for instance dep=-170 and ind=170, then 190 will be reutrned as alternative to -170
*/
public normalizeAngleAfterAnother(dep: number, ind: number, radians: boolean = true): number {
public normalizeAngleAfterAnother(dep: number, ind: number, radians: bool = true): number {
dep = this.normalizeAngle(dep - ind, radians);
return ind + dep;
@@ -372,7 +372,7 @@ module Phaser {
*
* for instance dep = 190 and ind = 170, then -170 will be returned as an alternative to 190
*/
public normalizeAngleBeforeAnother(dep: number, ind: number, radians: boolean = true): number {
public normalizeAngleBeforeAnother(dep: number, ind: number, radians: bool = true): number {
dep = this.normalizeAngle(ind - dep, radians);
return ind - dep;
@@ -381,7 +381,7 @@ module Phaser {
/**
* interpolate across the shortest arc between two angles
*/
public interpolateAngles(a1: number, a2: number, weight: number, radians: boolean = true, ease = null): number {
public interpolateAngles(a1: number, a2: number, weight: number, radians: bool = true, ease = null): number {
a1 = this.normalizeAngle(a1, radians);
a2 = this.normalizeAngleToAnother(a2, a1, radians);
@@ -521,7 +521,7 @@ module Phaser {
}
/**
* Generate a random boolean result based on the chance value
* Generate a random bool result based on the chance value
* <p>
* Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
* of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.
@@ -529,7 +529,7 @@ module Phaser {
* @param chance The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%)
* @return true if the roll passed, or false
*/
public chanceRoll(chance: number = 50): boolean {
public chanceRoll(chance: number = 50): bool {
if (chance <= 0)
{
@@ -633,7 +633,7 @@ module Phaser {
*
* @return True if the given number is odd. False if the given number is even.
*/
public isOdd(n: number): boolean {
public isOdd(n: number): bool {
if (n & 1)
{
@@ -653,7 +653,7 @@ module Phaser {
*
* @return True if the given number is even. False if the given number is odd.
*/
public isEven(n: number): boolean {
public isEven(n: number): bool {
if (n & 1)
{
@@ -983,7 +983,7 @@ module Phaser {
* Returns the distance from this Point object to the given Point object.
* @method distanceFrom
* @param {Point} target - The destination Point object.
* @param {Boolean} round - Round the distance to the nearest integer (default false)
* @param {bool} round - Round the distance to the nearest integer (default false)
* @return {Number} The distance between this Point object and the destination Point object.
**/
public distanceBetween(x1: number, y1: number, x2: number, y2: number): number {
+7 -7
View File
@@ -100,7 +100,7 @@ module Phaser {
private _basic;
private _members;
private _l: number;
private _overlapProcessed: boolean;
private _overlapProcessed: bool;
private _checkObject;
//public static physics: Phaser.Physics.Manager;
@@ -124,7 +124,7 @@ module Phaser {
/**
* Whether this branch of the tree can be subdivided or not.
*/
private _canSubdivide: boolean;
private _canSubdivide: bool;
/**
* Refers to the internal A and B linked lists,
@@ -228,7 +228,7 @@ module Phaser {
/**
* Internal, used during tree processing and overlap checks.
*/
private static _useBothLists: boolean;
private static _useBothLists: bool;
/**
* Internal, used during tree processing and overlap checks.
@@ -542,9 +542,9 @@ module Phaser {
* <code>QuadTree</code>'s other main function. Call this after adding objects
* using <code>QuadTree.load()</code> to compare the objects that you loaded.
*
* @return {Boolean} Whether or not any overlaps were found.
* @return {bool} Whether or not any overlaps were found.
*/
public execute(): boolean {
public execute(): bool {
this._overlapProcessed = false;
@@ -603,9 +603,9 @@ module Phaser {
/**
* A private for comparing an object against the contents of a node.
*
* @return {Boolean} Whether or not any overlaps were found.
* @return {bool} Whether or not any overlaps were found.
*/
private overlapNode(): boolean {
private overlapNode(): bool {
//Walk the list and check for overlaps
this._overlapProcessed = false;
+2 -2
View File
@@ -278,9 +278,9 @@ module Phaser {
/**
* Check if both the x and y of this vector equal the given value.
*
* @return {Boolean}
* @return {bool}
*/
public equals(value): boolean {
public equals(value): bool {
return (this.x == value && this.y == value);
}
+4 -4
View File
@@ -122,9 +122,9 @@ module Phaser {
*
* @param {Vec2} a Reference to a source Vec2 object.
* @param {Vec2} b Reference to a source Vec2 object.
* @return {Boolean}
* @return {bool}
*/
static equals(a: Vec2, b: Vec2): boolean {
static equals(a: Vec2, b: Vec2): bool {
return a.x == b.x && a.y == b.y;
}
@@ -134,9 +134,9 @@ module Phaser {
* @param {Vec2} a Reference to a source Vec2 object.
* @param {Vec2} b Reference to a source Vec2 object.
* @param {Vec2} epsilon
* @return {Boolean}
* @return {bool}
*/
static epsilonEquals(a: Vec2, b: Vec2, epsilon: number): boolean {
static epsilonEquals(a: Vec2, b: Vec2, epsilon: number): bool {
return Math.abs(a.x - b.x) <= epsilon && Math.abs(a.y - b.y) <= epsilon;
}
+2 -2
View File
@@ -30,7 +30,7 @@ module Phaser {
* You can specify a part of a domain, for example 'google' would match 'google.com', 'google.co.uk', etc.
* Do not include 'http://' at the start.
*/
public checkDomainName(domain: string): boolean {
public checkDomainName(domain: string): bool {
return window.location.hostname.indexOf(domain) !== -1;
}
@@ -40,7 +40,7 @@ module Phaser {
* If the value exists it is replaced with the new value given. If you don't provide a new value it is removed from the query string.
* Optionally you can redirect to the new url, or just return it as a string.
*/
public updateQueryString(key: string, value: string, redirect:boolean = false, url: string = ''):string {
public updateQueryString(key: string, value: string, redirect:bool = false, url: string = ''):string {
if (url == '')
{
+1 -1
View File
@@ -35,7 +35,7 @@ module Phaser.Particles {
/**
* If bindEmitter the particles can bind this emitter's property;
* @property bindEmitter
* @type {Boolean}
* @type {bool}
* @default true
*/
this.bindEmitter = true;
+4 -2
View File
@@ -142,11 +142,13 @@ module Phaser.Particles {
}
removeBehaviour(behaviour) {
var index = this.behaviours.indexOf(behaviour);
if (index > -1)
{
var behaviour = this.behaviours.splice(index, 1);
behaviour.parents = null;
var outBehaviour = this.behaviours.splice(index, 1);
//outBehaviour.parents = null;
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ module Phaser.Particles.Behaviours {
/**
* The behaviour is Dead;
* @property dead
* @type {Boolean}
* @type {bool}
*/
this.dead = false;
/**
+1 -1
View File
@@ -14,7 +14,7 @@ module Phaser.Particles.Zones {
vector: Phaser.Vec2;
random: number;
crossType: string;
alert: boolean;
alert: bool;
}
}
+218 -37
View File
@@ -18,6 +18,18 @@ module Phaser.Physics {
this.width = Math.abs(width);
this.height = Math.abs(height);
this.velocity = new Phaser.Vec2;
this.acceleration = new Phaser.Vec2;
this.bounce = new Phaser.Vec2(0, 0);
//this.drag = new Phaser.Vec2(1, 1);
//this.gravity = new Phaser.Vec2(0, 0.2);
this.drag = new Phaser.Vec2(0, 0);
this.gravity = new Phaser.Vec2(0, 2);
this.maxVelocity = new Phaser.Vec2(1000, 1000);
this.aabbTileProjections = {};
this.aabbTileProjections[Phaser.Physics.TileMapCell.CTYPE_22DEGs] = Phaser.Physics.Projection.AABB22Deg.CollideS;
this.aabbTileProjections[Phaser.Physics.TileMapCell.CTYPE_22DEGb] = Phaser.Physics.Projection.AABB22Deg.CollideB;
@@ -33,6 +45,13 @@ module Phaser.Physics {
public game: Phaser.Game;
public velocity: Phaser.Vec2;
public acceleration: Phaser.Vec2;
public drag: Phaser.Vec2;
public gravity: Phaser.Vec2;
public bounce: Phaser.Vec2;
public maxVelocity: Phaser.Vec2;
public static COL_NONE = 0;
public static COL_AXIS = 1;
public static COL_OTHER = 2;
@@ -45,12 +64,142 @@ module Phaser.Physics {
public oH: number;
public oV: number;
public _vx: number = 0;
public _vy: number = 0;
public _deltaX: number = 0;
public _deltaY: number = 0;
private aabbTileProjections;
public integrateVerlet() {
public update() {
var d = 1; // global drag
var g = 0.2; // global gravity
// Add 'go to sleep' option
this.oldpos.x = this.pos.x; //get vector values
this.oldpos.y = this.pos.y; //p = position
this._vx = (this.game.physics.computeVelocity(this.velocity.x, this.gravity.x, this.acceleration.x, this.drag.x, this.maxVelocity.x) - this.velocity.x) / 2;
this.velocity.x += this._vx;
//this.pos.x += (this.velocity.x * this.game.time.physicsElapsed) + this.gravity.x;
//this.pos.x += (this.velocity.x * this.game.time.physicsElapsed);
this._deltaX = this.velocity.x * this.game.time.physicsElapsed;
//body.aabb.pos.x += this._delta;
this._vy = (this.game.physics.computeVelocity(this.velocity.y, this.gravity.y, this.acceleration.y, this.drag.y, this.maxVelocity.y) - this.velocity.y) / 2;
//this._vy = this.game.physics.computeVelocity(this.velocity.y, this.gravity.y, this.acceleration.y, this.drag.y, this.maxVelocity.y);
this.velocity.y += this._vy;
//this.pos.y += (this.velocity.y * this.game.time.physicsElapsed) + this.gravity.y;
//this.pos.y += (this.velocity.y * this.game.time.physicsElapsed);
this._deltaY = this.velocity.y * this.game.time.physicsElapsed;
this.pos.x += this._deltaX;
this.pos.y += this._deltaY;
//this.integrateVerlet();
//var ox = this.oldpos.x;
//var oy = this.oldpos.y;
}
public FFupdate() {
this.oldpos.x = this.pos.x; //get vector values
this.oldpos.y = this.pos.y; //p = position
if (this.acceleration.x != 0)
{
this.velocity.x += (this.acceleration.x / 1000 * this.game.time.delta);
}
if (this.acceleration.y != 0)
{
this.velocity.y += (this.acceleration.y / 1000 * this.game.time.delta);
}
this._vx = ((this.velocity.x / 1000) * this.game.time.delta);
this._vy = ((this.velocity.y / 1000) * this.game.time.delta);
if (this._vx != 0)
{
if (this.drag.x != 0)
{
this._vx * this.drag.x;
}
if (this.gravity.x != 0)
{
this._vx * this.gravity.x;
}
if (this.velocity.x > this.maxVelocity.x)
{
this.velocity.x = this.maxVelocity.x;
}
else if (this.velocity.x < -this.maxVelocity.x)
{
this.velocity.x = -this.maxVelocity.x;
}
}
if (this._vy != 0)
{
if (this.drag.y != 0)
{
this._vy * this.drag.y;
}
if (this.gravity.y != 0)
{
this._vy * this.gravity.y;
}
if (this.velocity.y > this.maxVelocity.y)
{
this.velocity.y = this.maxVelocity.y;
}
else if (this.velocity.y < -this.maxVelocity.y)
{
this.velocity.y = -this.maxVelocity.y;
}
}
this.pos.x += this._vx;
this.pos.y += this._vy;
//this._vx = (this.game.physics.computeVelocity(this.velocity.x, this.gravity.x, this.acceleration.x, this.fdrag.x, this.maxVelocity.x) - this.velocity.x) / 2;
//this.velocity.x += this._vx;
//this.pos.x += (this.velocity.x * this.game.time.physicsElapsed) + this.gravity.x;
//this._vy = (this.game.physics.computeVelocity(this.velocity.y, this.gravity.y, this.acceleration.y, this.fdrag.y, this.maxVelocity.y) - this.velocity.y) / 2;
//this.velocity.y += this._vy;
//this.pos.y += (this.velocity.y * this.game.time.physicsElapsed) + this.gravity.y;
//this.integrateVerlet();
//var ox = this.oldpos.x;
//var oy = this.oldpos.y;
//this.oldpos.x = this.pos.x; //get vector values
//this.oldpos.y = this.pos.y; //p = position
//integrate
//this.pos.x += (this.drag.x * this.pos.x) - (this.drag.x * ox) + this.gravity.x;
//this.pos.y += (this.drag.y * this.pos.y) - (this.drag.y * oy) + this.gravity.y;
//this._vx = (this.velocity.x / 1000 * this.game.time.delta);
//this._vy = (this.velocity.y / 1000 * this.game.time.delta);
//this._vx = 0.2;
//this._vy = 0.2;
//this.pos.x = this.oldpos.x + Math.min(20, Math.max(-20, this.pos.x - this.oldpos.x + this._vx));
//this.pos.y = this.oldpos.y + Math.min(20, Math.max(-20, this.pos.y - this.oldpos.y + this._vy));
//this.integrateVerlet();
}
public integrateVerlet() {
var px = this.pos.x;
var py = this.pos.y;
@@ -62,42 +211,74 @@ module Phaser.Physics {
this.oldpos.y = this.pos.y; //p = position
//integrate
this.pos.x += (d * px) - (d * ox);
this.pos.y += (d * py) - (d * oy) + g;
this.pos.x += (this.drag.x * px) - (this.drag.x * ox) + this.gravity.x;
this.pos.y += (this.drag.y * py) - (this.drag.y * oy) + this.gravity.y;
}
public reportCollisionVsWorld(px: number, py: number, dx: number, dy: number, obj: TileMapCell = null) {
//calc velocity
var vx = this.pos.x - this.oldpos.x;
var vy = this.pos.y - this.oldpos.y;
//calc velocity (original way)
//this._vx = this.pos.x - this.oldpos.x;
//this._vy = this.pos.y - this.oldpos.y;
//var vx = this.pos.x - this.oldpos.x;
//var vy = this.pos.y - this.oldpos.y;
//find component of velocity parallel to collision normal
var dp = (vx * dx + vy * dy);
//var dp = (vx * dx + vy * dy);
//var nx = dp * dx;//project velocity onto collision normal
//var ny = dp * dy;//nx,ny is normal velocity
//var tx = vx - nx;//px,py is tangent velocity
//var ty = vy - ny;
var dp = (this._vx * dx + this._vy * dy);
var nx = dp * dx;//project velocity onto collision normal
var ny = dp * dy;//nx,ny is normal velocity
var tx = vx - nx;//px,py is tangent velocity
var ty = vy - ny;
var tx = this._vx - nx;//px,py is tangent velocity
var ty = this._vy - ny;
this.pos.x += px;//project object out of collision
//console.log('nxy', nx, ny);
//console.log('nxy', nx, ny);
//console.log('txy', tx, ty);
this.pos.x += px; //project object out of collision
this.pos.y += py;
this.oldpos.x += px;
this.oldpos.y += py;
//this.oldpos.x += px;
//this.oldpos.y += py;
//this.pos.x += px;
//this.pos.y += py;
//this.velocity.x += nx;
//this.velocity.y += ny;
//we only want to apply collision response forces if the object is travelling into, and not out of, the collision
if (dp < 0)
//if (1 < 0)
{
// moving into collision, apply forces
var b = 1 + 0.5;//this bounce constant should be elsewhere, i.e inside the object/tile/etc..
var f = 0.05; // friction
var fx = tx * f;
var fy = ty * f;
//var b = 1 + 0.5;//this bounce constant should be elsewhere, i.e inside the object/tile/etc..
//var b = 0.5;//this bounce constant should be elsewhere, i.e inside the object/tile/etc..
//var f = 0.05; // friction
//var fx = tx * f;
//var fy = ty * f;
this.oldpos.x += (nx * b) + fx;//apply bounce+friction impulses which alter velocity
this.oldpos.y += (ny * b) + fy;
//this.oldpos.x += (nx * b) + fx;//apply bounce+friction impulses which alter velocity
//this.oldpos.y += (ny * b) + fy;
this.velocity.x += nx;
this.velocity.y += ny;
if (dx !== 0)
{
// this.velocity.x *= -1 * this.bounce.x;
}
if (dy !== 0)
{
// this.velocity.y *= -1 * this.bounce.y;
}
}
}
@@ -173,7 +354,7 @@ module Phaser.Physics {
var YMAX = 600;
//collide vs. x-bounds
//test XMIN
//test XMIN left side
var dx = XMIN - (p.x - xw);
if (0 < dx)
{
@@ -182,7 +363,7 @@ module Phaser.Physics {
}
else
{
//test XMAX
//test XMAX right side
dx = (p.x + xw) - XMAX;
if (0 < dx)
{
@@ -192,7 +373,7 @@ module Phaser.Physics {
}
//collide vs. y-bounds
//test YMIN
//test YMIN top
var dy = YMIN - (p.y - yw);
if (0 < dy)
{
@@ -201,7 +382,7 @@ module Phaser.Physics {
}
else
{
//test YMAX
//test YMAX bottom
dy = (p.y + yw) - YMAX;
if (0 < dy)
{
@@ -211,6 +392,19 @@ module Phaser.Physics {
}
}
public resolveBoxTile(x, y, box, t) {
if (0 < t.ID)
{
return this.aabbTileProjections[t.CTYPE](x, y, box, t);
}
else
{
//trace("resolveBoxTile() was called with an empty (or unknown) tile!: ID=" + t.ID + " ("+ t.i + "," + t.j + ")");
return false;
}
}
public render(context: CanvasRenderingContext2D) {
context.beginPath();
@@ -224,19 +418,6 @@ module Phaser.Physics {
}
public resolveBoxTile(x, y, box, t) {
if (0 < t.ID)
{
return this.aabbTileProjections[t.CTYPE](x, y, box, t);
}
else
{
//trace("resolveBoxTile() was called with an empty (or unknown) tile!: ID=" + t.ID + " ("+ t.i + "," + t.j + ")");
return false;
}
}
}
}
+16 -11
View File
@@ -15,7 +15,7 @@ module Phaser.Physics {
this.game = sprite.game;
this.type = type;
//this.aabb = new Phaser.Physics.AABB(sprite.game, sprite.x, sprite.y, sprite.width, sprite.height);
this.aabb = new Phaser.Physics.AABB(sprite.game, sprite.x, sprite.y, sprite.width, sprite.height);
this.velocity = new Phaser.Vec2;
this.acceleration = new Phaser.Vec2;
@@ -26,10 +26,11 @@ module Phaser.Physics {
this.angularVelocity = 0;
this.angularAcceleration = 0;
this.angularDrag = 0;
this.maxAngular = 10000;
//this.touching = Phaser.Types.NONE;
//this.wasTouching = Phaser.Types.NONE;
//this.allowCollisions = Phaser.Types.ANY;
this.allowCollisions = Phaser.Types.ANY;
//this.position = new Phaser.Vec2(sprite.x + this.bounds.halfWidth, sprite.y + this.bounds.halfHeight);
//this.oldPosition = new Phaser.Vec2(sprite.x + this.bounds.halfWidth, sprite.y + this.bounds.halfHeight);
@@ -39,7 +40,7 @@ module Phaser.Physics {
public game: Phaser.Game;
public sprite: Phaser.Sprite;
//public aabb: Phaser.Physics.AABB;
public aabb: Phaser.Physics.AABB;
public bounds: Phaser.Rectangle;
/**
@@ -71,16 +72,20 @@ module Phaser.Physics {
*/
public facing: number;
public touching: number;
public allowCollisions: number;
public wasTouching: number;
public mass: number = 1;
public deltaX: number = 0;
public deltaY: number = 0;
public position: Phaser.Vec2;
public oldPosition: Phaser.Vec2;
public offset: Phaser.Vec2;
//public touching: number;
public allowCollisions: number;
//public wasTouching: number;
//public mass: number = 1;
//public position: Phaser.Vec2;
//public oldPosition: Phaser.Vec2;
//public offset: Phaser.Vec2;
//public bounds: Phaser.Rectangle;
/*
private _width: number = 0;
private _height: number = 0;
@@ -204,7 +209,7 @@ module Phaser.Physics {
public get deltaY(): number {
return this.position.y - this.oldPosition.y;
}
*/
}
}
+30 -43
View File
@@ -27,23 +27,23 @@ module Phaser.Physics {
public game: Phaser.Game;
// Temp calculation vars
//private _drag: number;
//private _delta: number;
//private _velocityDelta: number;
//private _length: number = 0;
//private _distance: Vec2;
//private _tangent: Vec2;
//private _separatedX: boolean;
//private _separatedY: boolean;
//private _overlap: number;
//private _maxOverlap: number;
//private _obj1Velocity: number;
//private _obj2Velocity: number;
//private _obj1NewVelocity: number;
//private _obj2NewVelocity: number;
//private _average: number;
//private _quadTree: QuadTree;
//private _quadTreeResult: boolean;
private _drag: number;
private _delta: number;
private _velocityDelta: number;
private _length: number = 0;
private _distance: Vec2;
private _tangent: Vec2;
private _separatedX: bool;
private _separatedY: bool;
private _overlap: number;
private _maxOverlap: number;
private _obj1Velocity: number;
private _obj2Velocity: number;
private _obj1NewVelocity: number;
private _obj2NewVelocity: number;
private _average: number;
private _quadTree: QuadTree;
private _quadTreeResult: bool;
//public bounds: Rectangle;
@@ -77,45 +77,32 @@ module Phaser.Physics {
maxspeed: number = 20;
public update() {
// Booyah!
//this.updateMotion(this._objects[i]);
}
/*
public updateMotion(body: Phaser.Physics.Body) {
if (body.type == Types.BODY_DISABLED)
{
return;
}
this._velocityDelta = (this.computeVelocity(body.angularVelocity, body.gravity.x, body.angularAcceleration, body.angularDrag, body.maxAngular) - body.angularVelocity) / 2;
body.angularVelocity += this._velocityDelta;
body.sprite.transform.rotation += body.angularVelocity * this.game.time.elapsed;
body.sprite.transform.rotation += body.angularVelocity * this.game.time.physicsElapsed;
body.angularVelocity += this._velocityDelta;
this._velocityDelta = (this.computeVelocity(body.velocity.x, body.gravity.x, body.acceleration.x, body.drag.x) - body.velocity.x) / 2;
body.velocity.x += this._velocityDelta;
this._delta = body.velocity.x * this.game.time.elapsed;
body.velocity.x += this._velocityDelta;
this._delta = body.velocity.x * this.game.time.physicsElapsed;
//body.position.x += this._delta;
//body.sprite.x += this._delta;
body.aabb.pos.x += this._delta;
body.deltaX = this._delta;
this._velocityDelta = (this.computeVelocity(body.velocity.y, body.gravity.y, body.acceleration.y, body.drag.y) - body.velocity.y) / 2;
body.velocity.y += this._velocityDelta;
this._delta = body.velocity.y * this.game.time.elapsed;
body.velocity.y += this._velocityDelta;
this._delta = body.velocity.y * this.game.time.physicsElapsed;
//body.position.y += this._delta;
//body.sprite.y += this._delta;
body.aabb.pos.y += this._delta;
body.deltaY = this._delta;
//body.aabb.integrateVerlet();
}
*/
/**
* A tween-like function that takes a starting velocity and some other factors and returns an altered velocity.
@@ -127,16 +114,15 @@ module Phaser.Physics {
*
* @return {number} The altered Velocity value.
*/
/*
public computeVelocity(velocity: number, gravity: number = 0, acceleration: number = 0, drag: number = 0, max: number = 10000): number {
if (acceleration !== 0)
{
velocity += (acceleration + gravity) * this.game.time.elapsed;
velocity += (acceleration + gravity) * this.game.time.physicsElapsed;
}
else if (drag !== 0)
{
this._drag = drag * this.game.time.elapsed;
this._drag = drag * this.game.time.physicsElapsed;
if (velocity - this._drag > 0)
{
@@ -151,10 +137,12 @@ module Phaser.Physics {
velocity = 0;
}
velocity += gravity;
//velocity += gravity;
}
if ((velocity != 0) && (max != 10000))
velocity += gravity;
if (velocity != 0)
{
if (velocity > max)
{
@@ -169,7 +157,6 @@ module Phaser.Physics {
return velocity;
}
*/
}
-2
View File
@@ -71,9 +71,7 @@ module Phaser.Physics.Projection {
return Phaser.Physics.Circle.COL_OTHER;
}
return true;
}
}
else
{
+1 -1
View File
@@ -30,7 +30,7 @@ module Phaser.Renderer.Canvas {
private _sin: number = 0;
private _cos: number = 1;
public preRender(camera: Phaser.Camera): boolean {
public preRender(camera: Phaser.Camera): bool {
if (camera.visible == false || camera.transform.scale.x == 0 || camera.transform.scale.y == 0 || camera.texture.alpha < 0.1)
{
+1 -1
View File
@@ -28,7 +28,7 @@ module Phaser.Renderer.Canvas {
private _sin: number = 0;
private _cos: number = 1;
public renderCircle(camera: Phaser.Camera, circle: Phaser.Circle, context, outline: boolean = false, fill: boolean = true, lineColor: string = 'rgb(0,255,0)', fillColor: string = 'rgba(0,100,0.0.3)', lineWidth: number = 1): boolean {
public renderCircle(camera: Phaser.Camera, circle: Phaser.Circle, context, outline: bool = false, fill: bool = true, lineColor: string = 'rgb(0,255,0)', fillColor: string = 'rgba(0,100,0.0.3)', lineWidth: number = 1): bool {
// Reset our temp vars
this._sx = 0;
@@ -31,9 +31,9 @@ module Phaser.Renderer.Canvas {
/**
* Check whether this object is visible in a specific camera Rectangle.
* @param camera {Rectangle} The Rectangle you want to check.
* @return {boolean} Return true if bounds of this sprite intersects the given Rectangle, otherwise return false.
* @return {bool} Return true if bounds of this sprite intersects the given Rectangle, otherwise return false.
*/
public inCamera(camera: Phaser.Camera, scrollZone: Phaser.ScrollZone): boolean {
public inCamera(camera: Phaser.Camera, scrollZone: Phaser.ScrollZone): bool {
// Object fixed in place regardless of the camera scrolling? Then it's always visible
if (scrollZone.transform.scrollFactor.equals(0))
@@ -46,7 +46,7 @@ module Phaser.Renderer.Canvas {
}
public render(camera: Phaser.Camera, scrollZone: Phaser.ScrollZone): boolean {
public render(camera: Phaser.Camera, scrollZone: Phaser.ScrollZone): bool {
if (scrollZone.transform.scale.x == 0 || scrollZone.transform.scale.y == 0 || scrollZone.texture.alpha < 0.1 || this.inCamera(camera, scrollZone) == false)
{
+4 -4
View File
@@ -28,9 +28,9 @@ module Phaser.Renderer.Canvas {
/**
* Check whether this object is visible in a specific camera Rectangle.
* @param camera {Rectangle} The Rectangle you want to check.
* @return {boolean} Return true if bounds of this sprite intersects the given Rectangle, otherwise return false.
* @return {bool} Return true if bounds of this sprite intersects the given Rectangle, otherwise return false.
*/
public inCamera(camera: Phaser.Camera, sprite: Phaser.Sprite): boolean {
public inCamera(camera: Phaser.Camera, sprite: Phaser.Sprite): bool {
// Object fixed in place regardless of the camera scrolling? Then it's always visible
if (sprite.transform.scrollFactor.equals(0))
@@ -46,9 +46,9 @@ module Phaser.Renderer.Canvas {
/**
* Render this sprite to specific camera. Called by game loop after update().
* @param camera {Camera} Camera this sprite will be rendered to.
* @return {boolean} Return false if not rendered, otherwise return true.
* @return {bool} Return false if not rendered, otherwise return true.
*/
public render(camera: Phaser.Camera, sprite: Phaser.Sprite): boolean {
public render(camera: Phaser.Camera, sprite: Phaser.Sprite): bool {
Phaser.SpriteUtils.updateCameraView(camera, sprite);
+1 -1
View File
@@ -32,7 +32,7 @@ module Phaser.Renderer.Canvas {
* Render a tilemap to a specific camera.
* @param camera {Camera} The camera this tilemap will be rendered to.
*/
public render(camera: Phaser.Camera, tilemap: Phaser.Tilemap): boolean {
public render(camera: Phaser.Camera, tilemap: Phaser.Tilemap): bool {
// Loop through the layers
+20 -20
View File
@@ -13,9 +13,9 @@ module Phaser {
/**
* Sound constructor
* @param [volume] {number} volume of this sound when playing.
* @param [loop] {boolean} loop this sound when playing? (Default to false)
* @param [loop] {bool} loop this sound when playing? (Default to false)
*/
constructor(game: Phaser.Game, key: string, volume: number = 1, loop: boolean = false) {
constructor(game: Phaser.Game, key: string, volume: number = 1, loop: bool = false) {
this.game = game;
@@ -115,27 +115,27 @@ module Phaser {
private _sound;
private _muteVolume: number;
private _muted: boolean = false;
private _muted: bool = false;
private _tempPosition: number;
private _tempVolume: number;
private _tempLoop: boolean;
private _tempLoop: bool;
private _tempMarker: string;
public usingWebAudio: boolean = false;
public usingAudioTag: boolean = false;
public usingWebAudio: bool = false;
public usingAudioTag: bool = false;
public name: string = '';
autoplay: boolean = false;
autoplay: bool = false;
totalDuration: number = 0;
startTime: number = 0;
currentTime: number = 0;
duration: number = 0;
stopTime: number = 0;
position: number;
paused: boolean = false;
loop: boolean = false;
isPlaying: boolean = false;
paused: bool = false;
loop: bool = false;
isPlaying: bool = false;
key: string;
markers;
currentMarker: string = '';
@@ -150,17 +150,17 @@ module Phaser {
public onMute: Phaser.Signal;
public onMarkerComplete: Phaser.Signal;
public pendingPlayback: boolean = false;
public pendingPlayback: bool = false;
public get isDecoding(): boolean {
public get isDecoding(): bool {
return this.game.cache.getSound(this.key).isDecoding;
}
public get isDecoded(): boolean {
public get isDecoded(): bool {
return this.game.cache.isSoundDecoded(this.key);
}
public addMarker(name: string, start: number, stop: number, volume: number = 1, loop: boolean = false) {
public addMarker(name: string, start: number, stop: number, volume: number = 1, loop: bool = false) {
this.markers[name] = { name: name, start: start, stop: stop, volume: volume, duration: stop - start, loop: loop };
}
@@ -229,16 +229,16 @@ module Phaser {
}
public override: boolean = false;
public override: bool = false;
/**
* Play this sound, or a marked section of it.
* @param marker {string} Assets key of the sound you want to play.
* @param [volume] {number} volume of the sound you want to play.
* @param [loop] {boolean} loop when it finished playing? (Default to false)
* @param [loop] {bool} loop when it finished playing? (Default to false)
* @return {Sound} The playing sound object.
*/
public play(marker: string = '', position: number = 0, volume: number = 1, loop: boolean = false, forceRestart: boolean = false) {
public play(marker: string = '', position: number = 0, volume: number = 1, loop: bool = false, forceRestart: bool = false) {
//console.log('play', marker, 'current is', this.currentMarker);
@@ -408,7 +408,7 @@ module Phaser {
}
public restart(marker: string = '', position: number = 0, volume: number = 1, loop: boolean = false) {
public restart(marker: string = '', position: number = 0, volume: number = 1, loop: bool = false) {
this.play(marker, position, volume, loop, true);
}
@@ -490,11 +490,11 @@ module Phaser {
/**
* Mute sounds.
*/
public get mute(): boolean {
public get mute(): bool {
return this._muted;
}
public set mute(value: boolean) {
public set mute(value: bool) {
if (value)
{
+8 -8
View File
@@ -100,9 +100,9 @@ module Phaser {
}
public usingWebAudio: boolean = false;
public usingAudioTag: boolean = false;
public noAudio: boolean = false;
public usingWebAudio: bool = false;
public usingAudioTag: bool = false;
public noAudio: bool = false;
/**
* Local reference to the current Phaser.Game.
@@ -128,11 +128,11 @@ module Phaser {
private _sounds: Phaser.Sound[];
private _muteVolume: number;
private _muted: boolean = false;
private _muted: bool = false;
public channels: number;
public touchLocked: boolean = false;
public touchLocked: bool = false;
private _unlockSource = null;
@@ -170,11 +170,11 @@ module Phaser {
/**
* A global audio mute toggle.
*/
public get mute():boolean {
public get mute():bool {
return this._muted;
}
public set mute(value: boolean) {
public set mute(value: bool) {
if (value)
{
@@ -356,7 +356,7 @@ module Phaser {
}
public add(key: string, volume: number = 1, loop: boolean = false): Sound {
public add(key: string, volume: number = 1, loop: bool = false): Sound {
var sound: Phaser.Sound = new Sound(this.game, key, volume, loop);
+77 -77
View File
@@ -28,141 +28,141 @@ module Phaser {
/**
* An optional 'fix' for the horrendous Android stock browser bug
* https://code.google.com/p/android/issues/detail?id=39247
* @type {boolean}
* @type {bool}
*/
public patchAndroidClearRectBug: boolean = false;
public patchAndroidClearRectBug: bool = false;
// Operating System
/**
* Is running desktop?
* @type {boolean}
* @type {bool}
*/
public desktop: boolean = false;
public desktop: bool = false;
/**
* Is running on iOS?
* @type {boolean}
* @type {bool}
*/
public iOS: boolean = false;
public iOS: bool = false;
/**
* Is running on android?
* @type {boolean}
* @type {bool}
*/
public android: boolean = false;
public android: bool = false;
/**
* Is running on chromeOS?
* @type {boolean}
* @type {bool}
*/
public chromeOS: boolean = false;
public chromeOS: bool = false;
/**
* Is running on linux?
* @type {boolean}
* @type {bool}
*/
public linux: boolean = false;
public linux: bool = false;
/**
* Is running on maxOS?
* @type {boolean}
* @type {bool}
*/
public macOS: boolean = false;
public macOS: bool = false;
/**
* Is running on windows?
* @type {boolean}
* @type {bool}
*/
public windows: boolean = false;
public windows: bool = false;
// Features
/**
* Is canvas available?
* @type {boolean}
* @type {bool}
*/
public canvas: boolean = false;
public canvas: bool = false;
/**
* Is file available?
* @type {boolean}
* @type {bool}
*/
public file: boolean = false;
public file: bool = false;
/**
* Is fileSystem available?
* @type {boolean}
* @type {bool}
*/
public fileSystem: boolean = false;
public fileSystem: bool = false;
/**
* Is localStorage available?
* @type {boolean}
* @type {bool}
*/
public localStorage: boolean = false;
public localStorage: bool = false;
/**
* Is webGL available?
* @type {boolean}
* @type {bool}
*/
public webGL: boolean = false;
public webGL: bool = false;
/**
* Is worker available?
* @type {boolean}
* @type {bool}
*/
public worker: boolean = false;
public worker: bool = false;
/**
* Is touch available?
* @type {boolean}
* @type {bool}
*/
public touch: boolean = false;
public touch: bool = false;
/**
* Is mspointer available?
* @type {boolean}
* @type {bool}
*/
public mspointer: boolean = false;
public mspointer: bool = false;
/**
* Is css3D available?
* @type {boolean}
* @type {bool}
*/
public css3D: boolean = false;
public css3D: bool = false;
// Browser
/**
* Is running in arora?
* @type {boolean}
* @type {bool}
*/
public arora: boolean = false;
public arora: bool = false;
/**
* Is running in chrome?
* @type {boolean}
* @type {bool}
*/
public chrome: boolean = false;
public chrome: bool = false;
/**
* Is running in epiphany?
* @type {boolean}
* @type {bool}
*/
public epiphany: boolean = false;
public epiphany: bool = false;
/**
* Is running in firefox?
* @type {boolean}
* @type {bool}
*/
public firefox: boolean = false;
public firefox: bool = false;
/**
* Is running in ie?
* @type {boolean}
* @type {bool}
*/
public ie: boolean = false;
public ie: bool = false;
/**
* Version of ie?
@@ -172,98 +172,98 @@ module Phaser {
/**
* Is running in mobileSafari?
* @type {boolean}
* @type {bool}
*/
public mobileSafari: boolean = false;
public mobileSafari: bool = false;
/**
* Is running in midori?
* @type {boolean}
* @type {bool}
*/
public midori: boolean = false;
public midori: bool = false;
/**
* Is running in opera?
* @type {boolean}
* @type {bool}
*/
public opera: boolean = false;
public opera: bool = false;
/**
* Is running in safari?
* @type {boolean}
* @type {bool}
*/
public safari: boolean = false;
public webApp: boolean = false;
public safari: bool = false;
public webApp: bool = false;
// Audio
/**
* Are Audio tags available?
* @type {boolean}
* @type {bool}
*/
public audioData: boolean = false;
public audioData: bool = false;
/**
* Is the WebAudio API available?
* @type {boolean}
* @type {bool}
*/
public webAudio: boolean = false;
public webAudio: bool = false;
/**
* Can this device play ogg files?
* @type {boolean}
* @type {bool}
*/
public ogg: boolean = false;
public ogg: bool = false;
/**
* Can this device play opus files?
* @type {boolean}
* @type {bool}
*/
public opus: boolean = false;
public opus: bool = false;
/**
* Can this device play mp3 files?
* @type {boolean}
* @type {bool}
*/
public mp3: boolean = false;
public mp3: bool = false;
/**
* Can this device play wav files?
* @type {boolean}
* @type {bool}
*/
public wav: boolean = false;
public wav: bool = false;
/**
* Can this device play m4a files?
* @type {boolean}
* @type {bool}
*/
public m4a: boolean = false;
public m4a: bool = false;
/**
* Can this device play webm files?
* @type {boolean}
* @type {bool}
*/
public webm: boolean = false;
public webm: bool = false;
// Device
/**
* Is running on iPhone?
* @type {boolean}
* @type {bool}
*/
public iPhone: boolean = false;
public iPhone: bool = false;
/**
* Is running on iPhone4?
* @type {boolean}
* @type {bool}
*/
public iPhone4: boolean = false;
public iPhone4: bool = false;
/**
* Is running on iPad?
* @type {boolean}
* @type {bool}
*/
public iPad: boolean = false;
public iPad: bool = false;
/**
* PixelRatio of the host device?
@@ -399,7 +399,7 @@ module Phaser {
}
public canPlayAudio(type: string): boolean {
public canPlayAudio(type: string): bool {
if (type == 'mp3' && this.mp3)
{
@@ -526,7 +526,7 @@ module Phaser {
}
public isConsoleOpen(): boolean {
public isConsoleOpen(): bool {
if (window.console && window.console['firebug'])
{
+8 -8
View File
@@ -55,17 +55,17 @@ module Phaser {
/**
*
* @property _isSetTimeOut
* @type Boolean
* @type bool
* @private
**/
private _isSetTimeOut: boolean = false;
private _isSetTimeOut: bool = false;
/**
*
* @method usingSetTimeOut
* @return Boolean
* @return bool
**/
public isUsingSetTimeOut(): boolean {
public isUsingSetTimeOut(): bool {
return this._isSetTimeOut;
@@ -74,9 +74,9 @@ module Phaser {
/**
*
* @method usingRAF
* @return Boolean
* @return bool
**/
public isUsingRAF(): boolean {
public isUsingRAF(): bool {
return this._isSetTimeOut === true;
@@ -85,9 +85,9 @@ module Phaser {
/**
*
* @property isRunning
* @type Boolean
* @type bool
**/
public isRunning: boolean = false;
public isRunning: bool = false;
/**
* A reference to the RAF/setTimeout to avoid constant anonymous function creation
+14 -14
View File
@@ -83,37 +83,37 @@ module Phaser {
/**
* If the game should be forced to use Landscape mode, this is set to true by Game.Stage
* @type {Boolean}
* @type {bool}
*/
public forceLandscape: boolean = false;
public forceLandscape: bool = false;
/**
* If the game should be forced to use Portrait mode, this is set to true by Game.Stage
* @type {Boolean}
* @type {bool}
*/
public forcePortrait: boolean = false;
public forcePortrait: bool = false;
/**
* If the game should be forced to use a specific orientation and the device currently isn't in that orientation this is set to true.
* @type {Boolean}
* @type {bool}
*/
public incorrectOrientation: boolean = false;
public incorrectOrientation: bool = false;
/**
* If you wish to align your game in the middle of the page then you can set this value to true.
* It will place a re-calculated margin-left pixel value onto the canvas element which is updated on orientation/resizing.
* It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.
* @type {Boolean}
* @type {bool}
*/
public pageAlignHorizontally: boolean = false;
public pageAlignHorizontally: bool = false;
/**
* If you wish to align your game in the middle of the page then you can set this value to true.
* It will place a re-calculated margin-left pixel value onto the canvas element which is updated on orientation/resizing.
* It doesn't care about any other DOM element that may be on the page, it literally just sets the margin.
* @type {Boolean}
* @type {bool}
*/
public pageAlignVeritcally: boolean = false;
public pageAlignVeritcally: bool = false;
/**
* Minimum width the canvas should be scaled to (in pixels)
@@ -190,7 +190,7 @@ module Phaser {
public enterPortrait: Phaser.Signal;
// Full Screen API calls
public get isFullScreen(): boolean {
public get isFullScreen(): bool {
if (document['fullscreenElement'] === null|| document['mozFullScreenElement'] === null|| document['webkitFullscreenElement'] === null)
{
@@ -285,11 +285,11 @@ module Phaser {
}
public get isPortrait(): boolean {
public get isPortrait(): bool {
return this.orientation == 0 || this.orientation == 180;
}
public get isLandscape(): boolean {
public get isLandscape(): bool {
return this.orientation === 90 || this.orientation === -90;
}
@@ -380,7 +380,7 @@ module Phaser {
/**
* Set screen size automatically based on the scaleMode.
*/
public setScreenSize(force: boolean = false) {
public setScreenSize(force: bool = false) {
if (this.game.device.iPad == false && this.game.device.webApp == false && this.game.device.desktop == false)
{
+3 -3
View File
@@ -26,8 +26,8 @@ module Phaser {
*/
public game: Phaser.Game;
private _showOnLandscape: boolean = false;
private _showOnPortrait: boolean = false;
private _showOnLandscape: bool = false;
private _showOnPortrait: bool = false;
/**
* Landscape Image. If you only want your game to work in Portrait mode, and display an image when in Landscape,
@@ -43,7 +43,7 @@ module Phaser {
*/
public portraitImage;
public enable(onLandscape: boolean, onPortrait: boolean, imageKey: string) {
public enable(onLandscape: bool, onPortrait: bool, imageKey: string) {
this._showOnLandscape = onLandscape;
this._showOnPortrait = onPortrait;
+16 -16
View File
@@ -68,39 +68,39 @@ module Phaser {
/**
* Indicating collide with any object on the left.
* @type {boolean}
* @type {bool}
*/
public collideLeft: boolean = false;
public collideLeft: bool = false;
/**
* Indicating collide with any object on the right.
* @type {boolean}
* @type {bool}
*/
public collideRight: boolean = false;
public collideRight: bool = false;
/**
* Indicating collide with any object on the top.
* @type {boolean}
* @type {bool}
*/
public collideUp: boolean = false;
public collideUp: bool = false;
/**
* Indicating collide with any object on the bottom.
* @type {boolean}
* @type {bool}
*/
public collideDown: boolean = false;
public collideDown: bool = false;
/**
* Enable separation at x-axis.
* @type {boolean}
* @type {bool}
*/
public separateX: boolean = true;
public separateX: bool = true;
/**
* Enable separation at y-axis.
* @type {boolean}
* @type {bool}
*/
public separateY: boolean = true;
public separateY: bool = true;
/**
* A reference to the tilemap this tile object belongs to.
@@ -128,11 +128,11 @@ module Phaser {
/**
* Set collision configs.
* @param collision {number} Bit field of flags. (see Tile.allowCollision)
* @param resetCollisions {boolean} Reset collision flags before set.
* @param separateX {boolean} Enable seprate at x-axis.
* @param separateY {boolean} Enable seprate at y-axis.
* @param resetCollisions {bool} Reset collision flags before set.
* @param separateX {bool} Enable seprate at x-axis.
* @param separateY {bool} Enable seprate at y-axis.
*/
public setCollision(collision: number, resetCollisions: boolean, separateX: boolean, separateY: boolean) {
public setCollision(collision: number, resetCollisions: bool, separateX: bool, separateY: bool) {
if (resetCollisions)
{
+17 -17
View File
@@ -19,11 +19,11 @@ module Phaser {
* @param key {string} Asset key for this map.
* @param mapData {string} Data of this map. (a big 2d array, normally in csv)
* @param format {number} Format of this map data, available: Tilemap.FORMAT_CSV or Tilemap.FORMAT_TILED_JSON.
* @param resizeWorld {boolean} Resize the world bound automatically based on this tilemap?
* @param resizeWorld {bool} Resize the world bound automatically based on this tilemap?
* @param tileWidth {number} Width of tiles in this map.
* @param tileHeight {number} Height of tiles in this map.
*/
constructor(game: Game, key: string, mapData: string, format: number, resizeWorld: boolean = true, tileWidth: number = 0, tileHeight: number = 0) {
constructor(game: Game, key: string, mapData: string, format: number, resizeWorld: bool = true, tileWidth: number = 0, tileHeight: number = 0) {
this.game = game;
this.type = Phaser.Types.TILEMAP;
@@ -88,22 +88,22 @@ module Phaser {
/**
* Controls if both <code>update</code> and render are called by the core game loop.
*/
public exists: boolean;
public exists: bool;
/**
* Controls if <code>update()</code> is automatically called by the core game loop.
*/
public active: boolean;
public active: bool;
/**
* Controls if this Sprite is rendered or skipped during the core game loop.
*/
public visible: boolean;
public visible: bool;
/**
* A useful state for many game objects. Kill and revive both flip this switch.
*/
public alive: boolean;
public alive: bool;
/**
* The texture used to render the Sprite.
@@ -320,11 +320,11 @@ module Phaser {
* @param start {number} First index of tiles.
* @param end {number} Last index of tiles.
* @param collision {number} Bit field of flags. (see Tile.allowCollision)
* @param resetCollisions {boolean} Reset collision flags before set.
* @param separateX {boolean} Enable seprate at x-axis.
* @param separateY {boolean} Enable seprate at y-axis.
* @param resetCollisions {bool} Reset collision flags before set.
* @param separateX {bool} Enable seprate at x-axis.
* @param separateY {bool} Enable seprate at y-axis.
*/
public setCollisionRange(start: number, end: number, collision:number = Types.ANY, resetCollisions: boolean = false, separateX: boolean = true, separateY: boolean = true) {
public setCollisionRange(start: number, end: number, collision:number = Types.ANY, resetCollisions: bool = false, separateX: bool = true, separateY: bool = true) {
for (var i = start; i < end; i++)
{
@@ -337,11 +337,11 @@ module Phaser {
* Set collision configs of tiles with given index.
* @param values {number[]} Index array which contains all tile indexes. The tiles with those indexes will be setup with rest parameters.
* @param collision {number} Bit field of flags. (see Tile.allowCollision)
* @param resetCollisions {boolean} Reset collision flags before set.
* @param separateX {boolean} Enable seprate at x-axis.
* @param separateY {boolean} Enable seprate at y-axis.
* @param resetCollisions {bool} Reset collision flags before set.
* @param separateX {bool} Enable seprate at x-axis.
* @param separateY {bool} Enable seprate at y-axis.
*/
public setCollisionByIndex(values:number[], collision:number = Types.ANY, resetCollisions: boolean = false, separateX: boolean = true, separateY: boolean = true) {
public setCollisionByIndex(values:number[], collision:number = Types.ANY, resetCollisions: bool = false, separateX: bool = true, separateY: bool = true) {
for (var i = 0; i < values.length; i++)
{
@@ -422,7 +422,7 @@ module Phaser {
* @param objectOrGroup {function} Target object of group you want to check.
* @param callback {function} This is called if objectOrGroup collides the tilemap.
* @param context {object} Callback will be called with this context.
* @return {boolean} Return true if this collides with given object, otherwise return false.
* @return {bool} Return true if this collides with given object, otherwise return false.
*/
public collide(objectOrGroup = null, callback = null, context = null) {
@@ -452,9 +452,9 @@ module Phaser {
/**
* Check whether this tilemap collides with the given game object.
* @param object {GameObject} Target object you want to check.
* @return {boolean} Return true if this collides with given object, otherwise return false.
* @return {bool} Return true if this collides with given object, otherwise return false.
*/
public collideGameObject(object: Phaser.Sprite): boolean {
public collideGameObject(object: Phaser.Sprite): bool {
if (object.body.type == Types.BODY_DYNAMIC && object.exists == true && object.body.allowCollisions != Types.NONE)
{
+6 -6
View File
@@ -104,15 +104,15 @@ module Phaser {
/**
* Controls whether update() and draw() are automatically called.
* @type {boolean}
* @type {bool}
*/
public exists: boolean = true;
public exists: bool = true;
/**
* Controls whether draw() are automatically called.
* @type {boolean}
* @type {bool}
*/
public visible: boolean = true;
public visible: bool = true;
/**
* Properties of this map layer. (normally set by map editors)
@@ -405,9 +405,9 @@ module Phaser {
* @param y {number} Y position of block's left-top corner.
* @param width {number} Width of block.
* @param height {number} Height of block.
* @param collisionOnly {boolean} Whethor or not ONLY return tiles which will collide (its allowCollisions value is not Collision.NONE).
* @param collisionOnly {bool} Whethor or not ONLY return tiles which will collide (its allowCollisions value is not Collision.NONE).
*/
private getTempBlock(x: number, y: number, width: number, height: number, collisionOnly: boolean = false) {
private getTempBlock(x: number, y: number, width: number, height: number, collisionOnly: bool = false) {
if (x < 0)
{
+15
View File
@@ -54,6 +54,14 @@ module Phaser {
*/
public elapsed: number = 0;
/**
* The elapsed time calculated for the physics motion updates.
* @property physicsElapsed
* @public
* @type {Number}
*/
public physicsElapsed: number = 0;
/**
* Game time counter.
* @property time
@@ -181,6 +189,8 @@ module Phaser {
this.time = this.now; // _total
this.physicsElapsed = 1.0 * (this.delta / 1000);
// Paused?
if (this.game.paused)
{
@@ -204,8 +214,13 @@ module Phaser {
* @private
*/
private gameResumed() {
// Level out the delta timer to avoid spikes
this.delta = 0;
this.physicsElapsed = 0;
this.time = Date.now();
this.pauseDuration = this.pausedTime;
}
/**
+13 -13
View File
@@ -78,15 +78,15 @@ module Phaser {
/**
* Will this tween automatically restart when it completes?
* @type {boolean}
* @type {bool}
*/
private _loop: boolean = false;
private _loop: bool = false;
/**
* A yoyo tween is one that plays once fully, then reverses back to the original tween values before completing.
* @type {boolean}
* @type {bool}
*/
private _yoyo: boolean = false;
private _yoyo: bool = false;
private _yoyoCount: number = 0;
/**
@@ -125,12 +125,12 @@ module Phaser {
* @param properties {object} Propertis you want to tween.
* @param [duration] {number} duration of this tween.
* @param [ease] {any} Easing function.
* @param [autoStart] {boolean} Whether this tween will start automatically or not.
* @param [autoStart] {bool} Whether this tween will start automatically or not.
* @param [delay] {number} delay before this tween will start, defaults to 0 (no delay)
* @param [loop] {boolean} Should the tween automatically restart once complete? (ignores any chained tweens)
* @param [loop] {bool} Should the tween automatically restart once complete? (ignores any chained tweens)
* @return {Tween} Itself.
*/
public to(properties, duration: number = 1000, ease: any = null, autoStart: boolean = false, delay: number = 0, loop: boolean = false, yoyo: boolean = false): Phaser.Tween {
public to(properties, duration: number = 1000, ease: any = null, autoStart: bool = false, delay: number = 0, loop: bool = false, yoyo: bool = false): Phaser.Tween {
this._duration = duration;
@@ -162,14 +162,14 @@ module Phaser {
}
public loop(value: boolean): Phaser.Tween {
public loop(value: bool): Phaser.Tween {
this._loop = value;
return this;
}
public yoyo(value: boolean): Phaser.Tween {
public yoyo(value: bool): Phaser.Tween {
this._yoyo = value;
this._yoyoCount = 0;
@@ -177,12 +177,12 @@ module Phaser {
}
public isRunning: boolean = false;
public isRunning: bool = false;
/**
* Start to tween.
*/
public start(looped: boolean = false): Phaser.Tween {
public start(looped: bool = false): Phaser.Tween {
if (this.game === null || this._object === null)
{
@@ -345,12 +345,12 @@ module Phaser {
}
private _paused: boolean;
private _paused: bool;
/**
* Update tweening.
* @param time {number} Current time from game clock.
* @return {boolean} Return false if this completed and no need to update, otherwise return true.
* @return {bool} Return false if this completed and no need to update, otherwise return true.
*/
public update(time: number) {
+2 -2
View File
@@ -65,7 +65,7 @@ module Phaser {
* @param [localReference] {bool} If true the tween will be stored in the object.tween property so long as it exists. If already set it'll be over-written.
* @return {Phaser.Tween} The newly created tween object.
*/
public create(object, localReference:boolean = false): Phaser.Tween {
public create(object, localReference:bool = false): Phaser.Tween {
if (localReference)
{
@@ -114,7 +114,7 @@ module Phaser {
/**
* Update all the tween objects you added to this manager.
*
* @return {boolean} Return false if there's no tween to update, otherwise return true.
* @return {bool} Return false if there's no tween to update, otherwise return true.
*/
public update() {
+3 -3
View File
@@ -109,7 +109,7 @@ module Phaser.UI {
// TODO
//public tabIndex: number;
//public tabEnabled: boolean;
//public tabEnabled: bool;
// ENTER or SPACE can activate this button if it has focus
@@ -197,11 +197,11 @@ module Phaser.UI {
return this.input.priorityID;
}
public set useHandCursor(value: boolean) {
public set useHandCursor(value: bool) {
this.input.useHandCursor = value;
}
public get useHandCursor(): boolean {
public get useHandCursor(): bool {
return this.input.useHandCursor;
}
+4 -4
View File
@@ -66,10 +66,10 @@ module Phaser {
* @method addToDOM
* @param {HTMLCanvasElement} canvas The canvas to set the touch action on.
* @param {String} parent The DOM element to add the canvas to. Defaults to ''.
* @param {Boolean} overflowHidden If set to true it will add the overflow='hidden' style to the parent DOM element.
* @param {bool} overflowHidden If set to true it will add the overflow='hidden' style to the parent DOM element.
* @return {HTMLCanvasElement} Returns the source canvas.
*/
public static addToDOM(canvas: HTMLCanvasElement, parent: string = '', overflowHidden: boolean = true): HTMLCanvasElement {
public static addToDOM(canvas: HTMLCanvasElement, parent: string = '', overflowHidden: bool = true): HTMLCanvasElement {
if ((parent !== '' || parent !== null) && document.getElementById(parent))
{
@@ -119,10 +119,10 @@ module Phaser {
*
* @method setSmoothingEnabled
* @param {CanvasRenderingContext2D} context The context to enable or disable the image smoothing on.
* @param {Boolean} overflowHidden If set to true it will enable image smoothing, false will disable it.
* @param {bool} overflowHidden If set to true it will enable image smoothing, false will disable it.
* @return {CanvasRenderingContext2D} Returns the source context.
*/
public static setSmoothingEnabled(context: CanvasRenderingContext2D, value: boolean): CanvasRenderingContext2D {
public static setSmoothingEnabled(context: CanvasRenderingContext2D, value: bool): CanvasRenderingContext2D {
context['imageSmoothingEnabled'] = value;
context['mozImageSmoothingEnabled'] = value;
+16 -16
View File
@@ -32,9 +32,9 @@ module Phaser {
* @param {Phaser.Circle} a The Circle to be checked.
* @param {Number} x The X value of the coordinate to test.
* @param {Number} y The Y value of the coordinate to test.
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
* @return {bool} True if the coordinates are within this circle, otherwise false.
*/
public static contains(a: Phaser.Circle, x: number, y: number): boolean {
public static contains(a: Phaser.Circle, x: number, y: number): bool {
// Check if x/y are within the bounds first
if (x >= a.left && x <= a.right && y >= a.top && y <= a.bottom)
@@ -53,9 +53,9 @@ module Phaser {
* @method containsPoint
* @param {Phaser.Circle} a The Circle object.
* @param {Phaser.Point} point The Point object to test.
* @return {Boolean} True if the coordinates are within this circle, otherwise false.
* @return {bool} True if the coordinates are within this circle, otherwise false.
*/
public static containsPoint(a: Phaser.Circle, point: Phaser.Point): boolean {
public static containsPoint(a: Phaser.Circle, point: Phaser.Point): bool {
return CircleUtils.contains(a, point.x, point.y);
}
@@ -64,9 +64,9 @@ module Phaser {
* @method containsCircle
* @param {Phaser.Circle} a The Circle object to test.
* @param {Phaser.Circle} b The Circle object to test.
* @return {Boolean} True if Circle B is contained entirely inside of Circle A, otherwise false.
* @return {bool} True if Circle B is contained entirely inside of Circle A, otherwise false.
*/
public static containsCircle(a: Phaser.Circle, b: Phaser.Circle): boolean {
public static containsCircle(a: Phaser.Circle, b: Phaser.Circle): bool {
//return ((a.radius + b.radius) * (a.radius + b.radius)) >= Collision.distanceSquared(a.x, a.y, b.x, b.y);
return true;
}
@@ -77,10 +77,10 @@ module Phaser {
* @method distanceBetween
* @param {Phaser.Circle} a The Circle object.
* @param {Phaser.Circle} b The target object. Must have visible x and y properties that represent the center of the object.
* @param {Boolean} [optional] round Round the distance to the nearest integer (default false)
* @param {bool} [optional] round Round the distance to the nearest integer (default false)
* @return {Number} The distance between this Point object and the destination Point object.
*/
public static distanceBetween(a: Phaser.Circle, target: any, round: boolean = false): number {
public static distanceBetween(a: Phaser.Circle, target: any, round: bool = false): number {
var dx = a.x - target.x;
var dy = a.y - target.y;
@@ -101,9 +101,9 @@ module Phaser {
* @method equals
* @param {Phaser.Circle} a The first Circle object.
* @param {Phaser.Circle} b The second Circle object.
* @return {Boolean} A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.
* @return {bool} A value of true if the object has exactly the same values for the x, y and diameter properties as this Circle object; otherwise false.
*/
public static equals(a: Phaser.Circle, b: Phaser.Circle): boolean {
public static equals(a: Phaser.Circle, b: Phaser.Circle): bool {
return (a.x == b.x && a.y == b.y && a.diameter == b.diameter);
}
@@ -113,9 +113,9 @@ module Phaser {
* @method intersects
* @param {Phaser.Circle} a The first Circle object.
* @param {Phaser.Circle} b The second Circle object.
* @return {Boolean} A value of true if the specified object intersects with this Circle object; otherwise false.
* @return {bool} A value of true if the specified object intersects with this Circle object; otherwise false.
*/
public static intersects(a: Phaser.Circle, b: Phaser.Circle): boolean {
public static intersects(a: Phaser.Circle, b: Phaser.Circle): bool {
return (Phaser.CircleUtils.distanceBetween(a, b) <= (a.radius + b.radius));
}
@@ -124,11 +124,11 @@ module Phaser {
* @method circumferencePoint
* @param {Phaser.Circle} a The first Circle object.
* @param {Number} angle The angle in radians (unless asDegrees is true) to return the point from.
* @param {Boolean} asDegrees Is the given angle in radians (false) or degrees (true)?
* @param {bool} asDegrees Is the given angle in radians (false) or degrees (true)?
* @param {Phaser.Point} [optional] output An optional Point object to put the result in to. If none specified a new Point object will be created.
* @return {Phaser.Point} The Point object holding the result.
*/
public static circumferencePoint(a: Phaser.Circle, angle: number, asDegrees: boolean = false, out: Phaser.Point = new Phaser.Point): Phaser.Point {
public static circumferencePoint(a: Phaser.Circle, angle: number, asDegrees: bool = false, out: Phaser.Point = new Phaser.Point): Phaser.Point {
if (asDegrees === true)
{
@@ -144,9 +144,9 @@ module Phaser {
* @method intersectsRectangle
* @param {Phaser.Circle} c The Circle object to test.
* @param {Phaser.Rectangle} r The Rectangle object to test.
* @return {Boolean} True if the two objects intersect, otherwise false.
* @return {bool} True if the two objects intersect, otherwise false.
*/
public static intersectsRectangle(c: Phaser.Circle, r: Phaser.Rectangle): boolean {
public static intersectsRectangle(c: Phaser.Circle, r: Phaser.Rectangle): bool {
var cx: number = Math.abs(c.x - r.x - r.halfWidth);
var xDist: number = r.halfWidth + c.radius;
+3 -3
View File
@@ -68,9 +68,9 @@ module Phaser {
/**
* If set to true this will render a shadow below any debug text, often making it easier to read.
* @property renderShadow
* @type {Boolean}
* @type {bool}
*/
public static renderShadow: boolean = true;
public static renderShadow: bool = true;
/**
* Internal method that resets the debug output values.
@@ -184,7 +184,7 @@ module Phaser {
* Renders the Pointer.circle object onto the stage in green if down or red if up.
* @method renderDebug
*/
static renderPointer(pointer: Phaser.Pointer, hideIfUp: boolean = false, downColor: string = 'rgba(0,255,0,0.5)', upColor: string = 'rgba(255,0,0,0.5)', color: string = 'rgb(255,255,255)') {
static renderPointer(pointer: Phaser.Pointer, hideIfUp: bool = false, downColor: string = 'rgba(0,255,0,0.5)', upColor: string = 'rgba(255,0,0,0.5)', color: string = 'rgb(255,255,255)') {
if (hideIfUp == true && pointer.isUp == true)
{
+8 -8
View File
@@ -124,10 +124,10 @@ module Phaser {
* @method distanceBetween
* @param {Phaser.Point} a The first Point object.
* @param {Phaser.Point} b The second Point object.
* @param {Boolean} round Round the distance to the nearest integer (default false)
* @param {bool} round Round the distance to the nearest integer (default false)
* @return {Number} The distance between the two Point objects.
*/
public static distanceBetween(a: Phaser.Point, b: Phaser.Point, round: boolean = false): number {
public static distanceBetween(a: Phaser.Point, b: Phaser.Point, round: bool = false): number {
var dx = a.x - b.x;
var dy = a.y - b.y;
@@ -148,9 +148,9 @@ module Phaser {
* @method equals
* @param {Phaser.Point} a The first Point object.
* @param {Phaser.Point} b The second Point object.
* @return {Boolean} A value of true if the Points are equal, otherwise false.
* @return {bool} A value of true if the Points are equal, otherwise false.
*/
public static equals(a: Phaser.Point, b: Phaser.Point): boolean {
public static equals(a: Phaser.Point, b: Phaser.Point): bool {
return (a.x == b.x && a.y == b.y);
}
@@ -185,11 +185,11 @@ module Phaser {
* @param {Number} x The x coordinate of the anchor point
* @param {Number} y The y coordinate of the anchor point
* @param {Number} angle The angle in radians (unless asDegrees is true) to rotate the Point to.
* @param {Boolean} asDegrees Is the given rotation in radians (false) or degrees (true)?
* @param {bool} asDegrees Is the given rotation in radians (false) or degrees (true)?
* @param {Number} distance An optional distance constraint between the Point and the anchor.
* @return {Phaser.Point} The modified point object
*/
public static rotate(a: Phaser.Point, x: number, y: number, angle: number, asDegrees: boolean = false, distance: number = null): Phaser.Point {
public static rotate(a: Phaser.Point, x: number, y: number, angle: number, asDegrees: bool = false, distance: number = null): Phaser.Point {
if (asDegrees)
{
@@ -212,11 +212,11 @@ module Phaser {
* @param {Phaser.Point} a The Point object to rotate.
* @param {Phaser.Point} b The Point object to serve as point of rotation.
* @param {Number} angle The angle in radians (unless asDegrees is true) to rotate the Point to.
* @param {Boolean} asDegrees Is the given rotation in radians (false) or degrees (true)?
* @param {bool} asDegrees Is the given rotation in radians (false) or degrees (true)?
* @param {Number} distance An optional distance constraint between the Point and the anchor.
* @return {Phaser.Point} The modified point object
*/
public static rotateAroundPoint(a: Phaser.Point, b: Phaser.Point, angle: number, asDegrees: boolean = false, distance: number = null): Phaser.Point {
public static rotateAroundPoint(a: Phaser.Point, b: Phaser.Point, angle: number, asDegrees: bool = false, distance: number = null): Phaser.Point {
return Phaser.PointUtils.rotate(a, b.x, b.y, angle, asDegrees, distance);
}
+12 -12
View File
@@ -96,9 +96,9 @@ module Phaser {
* @param {Phaser.Rectangle} a The Rectangle object.
* @param {Number} x The x coordinate of the point to test.
* @param {Number} y The y coordinate of the point to test.
* @return {Boolean} A value of true if the Rectangle object contains the specified point; otherwise false.
* @return {bool} A value of true if the Rectangle object contains the specified point; otherwise false.
*/
public static contains(a: Phaser.Rectangle, x: number, y: number): boolean {
public static contains(a: Phaser.Rectangle, x: number, y: number): bool {
return (x >= a.x && x <= a.right && y >= a.y && y <= a.bottom);
}
@@ -107,9 +107,9 @@ module Phaser {
* @method containsPoint
* @param {Phaser.Rectangle} a The Rectangle object.
* @param {Phaser.Point} point The point object being checked. Can be Point or any object with .x and .y values.
* @return {Boolean} A value of true if the Rectangle object contains the specified point; otherwise false.
* @return {bool} A value of true if the Rectangle object contains the specified point; otherwise false.
*/
public static containsPoint(a: Phaser.Rectangle, point: Phaser.Point): boolean {
public static containsPoint(a: Phaser.Rectangle, point: Phaser.Point): bool {
return Phaser.RectangleUtils.contains(a, point.x, point.y);
}
@@ -119,9 +119,9 @@ module Phaser {
* @method containsRect
* @param {Phaser.Rectangle} a The first Rectangle object.
* @param {Phaser.Rectangle} b The second Rectangle object.
* @return {Boolean} A value of true if the Rectangle object contains the specified point; otherwise false.
* @return {bool} A value of true if the Rectangle object contains the specified point; otherwise false.
*/
public static containsRect(a: Phaser.Rectangle, b: Phaser.Rectangle): boolean {
public static containsRect(a: Phaser.Rectangle, b: Phaser.Rectangle): bool {
// If the given rect has a larger volume than this one then it can never contain it
if (a.volume > b.volume)
@@ -139,9 +139,9 @@ module Phaser {
* @method equals
* @param {Phaser.Rectangle} a The first Rectangle object.
* @param {Phaser.Rectangle} b The second Rectangle object.
* @return {Boolean} A value of true if the two Rectangles have exactly the same values for the x, y, width and height properties; otherwise false.
* @return {bool} A value of true if the two Rectangles have exactly the same values for the x, y, width and height properties; otherwise false.
*/
public static equals(a: Phaser.Rectangle, b: Phaser.Rectangle): boolean {
public static equals(a: Phaser.Rectangle, b: Phaser.Rectangle): bool {
return (a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height);
}
@@ -174,9 +174,9 @@ module Phaser {
* @param {Phaser.Rectangle} a The first Rectangle object.
* @param {Phaser.Rectangle} b The second Rectangle object.
* @param {Number} tolerance A tolerance value to allow for an intersection test with padding, default to 0
* @return {Boolean} A value of true if the specified object intersects with this Rectangle object; otherwise false.
* @return {bool} A value of true if the specified object intersects with this Rectangle object; otherwise false.
*/
public static intersects(a: Phaser.Rectangle, b: Phaser.Rectangle, tolerance: number = 0): boolean {
public static intersects(a: Phaser.Rectangle, b: Phaser.Rectangle, tolerance: number = 0): bool {
return !(a.left > b.right + tolerance || a.right < b.left - tolerance || a.top > b.bottom + tolerance || a.bottom < b.top - tolerance);
}
@@ -188,9 +188,9 @@ module Phaser {
* @param {Number} top
* @param {Number} bottomt
* @param {Number} tolerance A tolerance value to allow for an intersection test with padding, default to 0
* @return {Boolean} A value of true if the specified object intersects with the Rectangle; otherwise false.
* @return {bool} A value of true if the specified object intersects with the Rectangle; otherwise false.
*/
public static intersectsRaw(a: Phaser.Rectangle, left: number, right: number, top: number, bottom: number, tolerance: number = 0): boolean {
public static intersectsRaw(a: Phaser.Rectangle, left: number, right: number, top: number, bottom: number, tolerance: number = 0): bool {
return !(left > a.right + tolerance || right < a.left - tolerance || top > a.bottom + tolerance || bottom < a.top - tolerance);
}
+10 -10
View File
@@ -121,17 +121,17 @@ module Phaser {
* WARNING: Currently tilemaps do NOT support screen space overlap checks!
*
* @param objectOrGroup {object} The object or group being tested.
* @param inScreenSpace {boolean} Whether to take scroll factors numbero account when checking for overlap. Default is false, or "only compare in world space."
* @param inScreenSpace {bool} Whether to take scroll factors numbero account when checking for overlap. Default is false, or "only compare in world space."
* @param camera {Camera} Specify which game camera you want. If null getScreenXY() will just grab the first global camera.
*
* @return {boolean} Whether or not the objects overlap this.
* @return {bool} Whether or not the objects overlap this.
*/
/*
static overlaps(objectOrGroup, inScreenSpace: boolean = false, camera: Camera = null): boolean {
static overlaps(objectOrGroup, inScreenSpace: bool = false, camera: Camera = null): bool {
if (objectOrGroup.isGroup)
{
var results: boolean = false;
var results: bool = false;
var i: number = 0;
var members = <Group> objectOrGroup.members;
@@ -175,9 +175,9 @@ module Phaser {
* @param {Sprite} sprite The Sprite to check. It will take scaling and rotation into account.
* @param {Number} x The x coordinate in world space.
* @param {Number} y The y coordinate in world space.
* @return {Boolean} Whether or not the point overlaps this object.
* @return {bool} Whether or not the point overlaps this object.
*/
public static overlapsXY(sprite: Phaser.Sprite, x: number, y: number): boolean {
public static overlapsXY(sprite: Phaser.Sprite, x: number, y: number): bool {
// if rotation == 0 then just do a rect check instead!
if (sprite.transform.rotation == 0)
@@ -216,9 +216,9 @@ module Phaser {
* @method overlapsPoint
* @param {Sprite} sprite The Sprite to check. It will take scaling and rotation into account.
* @param {Point} point The point in world space you want to check.
* @return {Boolean} Whether or not the point overlaps this object.
* @return {bool} Whether or not the point overlaps this object.
*/
public static overlapsPoint(sprite: Phaser.Sprite, point: Phaser.Point): boolean {
public static overlapsPoint(sprite: Phaser.Sprite, point: Phaser.Point): bool {
return Phaser.SpriteUtils.overlapsXY(sprite, point.x, point.y);
}
@@ -228,9 +228,9 @@ module Phaser {
* @method onScreen
* @param {Sprite} sprite The Sprite to check. It will take scaling and rotation into account.
* @param {Camera} camera Specify which game camera you want. If null getScreenXY() will just grab the first global camera.
* @return {Boolean} Whether the object is on screen or not.
* @return {bool} Whether the object is on screen or not.
*/
public static onScreen(sprite: Phaser.Sprite, camera: Phaser.Camera = null): boolean {
public static onScreen(sprite: Phaser.Sprite, camera: Phaser.Camera = null): bool {
if (camera == null)
{
+2 -2
View File
@@ -22,9 +22,9 @@ module Phaser.Plugins.CameraFX {
/**
* Whether render border of this camera or not. (default is true)
* @type {boolean}
* @type {bool}
*/
public showBorder: boolean = true;
public showBorder: bool = true;
/**
* Color of border of this camera. (in css color string)
+1 -1
View File
@@ -33,7 +33,7 @@ module Phaser.Plugins.CameraFX {
* @param OnComplete An optional function you want to run when the flash finishes. Set to null for no callback.
* @param Force Force an already running flash effect to reset.
*/
public start(color: number = 0x000000, duration: number = 1, onComplete = null, force: boolean = false) {
public start(color: number = 0x000000, duration: number = 1, onComplete = null, force: bool = false) {
if (force === false && this._fxFadeAlpha > 0)
{
+1 -1
View File
@@ -33,7 +33,7 @@ module Phaser.Plugins.CameraFX {
* @param OnComplete An optional function you want to run when the flash finishes. Set to null for no callback.
* @param Force Force an already running flash effect to reset.
*/
public start(color: number = 0xffffff, duration: number = 1, onComplete = null, force: boolean = false) {
public start(color: number = 0xffffff, duration: number = 1, onComplete = null, force: bool = false) {
if (force === false && this._fxFlashAlpha > 0)
{
+13 -24
View File
@@ -1,5 +1,4 @@
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
@@ -18,76 +17,66 @@ var Phaser;
var Mirror = (function (_super) {
__extends(Mirror, _super);
function Mirror(game, parent) {
_super.call(this, game, parent);
_super.call(this, game, parent);
this._mirrorColor = null;
this.flipX = false;
this.flipY = true;
this.cls = false;
this.camera = parent;
this._canvas = document.createElement('canvas');
this._canvas.width = parent.width;
this._canvas.height = parent.height;
this._context = this._canvas.getContext('2d');
}
/**
Mirror.prototype.start = /**
* This is the rectangular region to grab from the Camera used in the Mirror effect
* It is rendered to the Stage at Mirror.x/y (note the use of Stage coordinates, not World coordinates)
*/
Mirror.prototype.start = function (x, y, region, fillColor) {
function (x, y, region, fillColor) {
if (typeof fillColor === "undefined") { fillColor = 'rgba(0, 0, 100, 0.5)'; }
this.x = x;
this.y = y;
this._mirrorX = region.x;
this._mirrorY = region.y;
this._mirrorWidth = region.width;
this._mirrorHeight = region.height;
if (fillColor) {
if(fillColor) {
this._mirrorColor = fillColor;
this._context.fillStyle = this._mirrorColor;
}
};
Mirror.prototype.postRender = function () {
this._sx = this.camera.screenView.x + this._mirrorX;
this._sy = this.camera.screenView.y + this._mirrorY;
if (this.flipX == true && this.flipY == false) {
if(this.flipX == true && this.flipY == false) {
this._sx = 0;
} else if (this.flipY == true && this.flipX == false) {
} else if(this.flipY == true && this.flipX == false) {
this._sy = 0;
}
this._context.drawImage(this.game.stage.canvas, this._sx, this._sy, this._mirrorWidth, this._mirrorHeight, 0, 0, this._mirrorWidth, this._mirrorHeight);
if (this._mirrorColor) {
if(this._mirrorColor) {
this._context.fillRect(0, 0, this._mirrorWidth, this._mirrorHeight);
}
if (this.flipX || this.flipY) {
if(this.flipX || this.flipY) {
this.game.stage.context.save();
}
if (this.flipX && this.flipY) {
if(this.flipX && this.flipY) {
this.game.stage.context.transform(-1, 0, 0, -1, this._mirrorWidth, this._mirrorHeight);
this.game.stage.context.drawImage(this._canvas, -this.x, -this.y);
} else if (this.flipX) {
} else if(this.flipX) {
this.game.stage.context.transform(-1, 0, 0, 1, this._mirrorWidth, 0);
this.game.stage.context.drawImage(this._canvas, -this.x, this.y);
} else if (this.flipY) {
} else if(this.flipY) {
this.game.stage.context.transform(1, 0, 0, -1, 0, this._mirrorHeight);
this.game.stage.context.drawImage(this._canvas, this.x, -this.y);
}
if (this.flipX || this.flipY) {
if(this.flipX || this.flipY) {
this.game.stage.context.restore();
}
};
return Mirror;
})(Phaser.Plugin);
CameraFX.Mirror = Mirror;
CameraFX.Mirror = Mirror;
})(Plugins.CameraFX || (Plugins.CameraFX = {}));
var CameraFX = Plugins.CameraFX;
})(Phaser.Plugins || (Phaser.Plugins = {}));
+3 -3
View File
@@ -36,12 +36,12 @@ module Phaser.Plugins.CameraFX {
public camera: Phaser.Camera;
public flipX: boolean = false;
public flipY: boolean = true;
public flipX: bool = false;
public flipY: bool = true;
public x: number;
public y: number;
public cls: boolean = false;
public cls: bool = false;
/**
* This is the rectangular region to grab from the Camera used in the Mirror effect
+3 -5
View File
@@ -1,5 +1,4 @@
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
@@ -18,21 +17,20 @@ var Phaser;
var Scanlines = (function (_super) {
__extends(Scanlines, _super);
function Scanlines(game, parent) {
_super.call(this, game, parent);
_super.call(this, game, parent);
this.spacing = 4;
this.color = 'rgba(0, 0, 0, 0.3)';
this.camera = parent;
}
Scanlines.prototype.postRender = function () {
this.game.stage.context.fillStyle = this.color;
for (var y = this.camera.screenView.y; y < this.camera.screenView.height; y += this.spacing) {
for(var y = this.camera.screenView.y; y < this.camera.screenView.height; y += this.spacing) {
this.game.stage.context.fillRect(this.camera.screenView.x, y, this.camera.screenView.width, 1);
}
};
return Scanlines;
})(Phaser.Plugin);
CameraFX.Scanlines = Scanlines;
CameraFX.Scanlines = Scanlines;
})(Plugins.CameraFX || (Plugins.CameraFX = {}));
var CameraFX = Plugins.CameraFX;
})(Phaser.Plugins || (Phaser.Plugins = {}));
+2 -2
View File
@@ -22,9 +22,9 @@ module Phaser.Plugins.CameraFX {
/**
* Render camera shadow or not. (default is false)
* @type {boolean}
* @type {bool}
*/
public showShadow: boolean = false;
public showShadow: bool = false;
/**
* Color of shadow, in css color string.
+1 -1
View File
@@ -41,7 +41,7 @@ module Phaser.Plugins.CameraFX {
* @param Force Force the effect to reset (default = true, unlike flash() and fade()!).
* @param Direction Whether to shake on both axes, just up and down, or just side to side (use class constants SHAKE_BOTH_AXES, SHAKE_VERTICAL_ONLY, or SHAKE_HORIZONTAL_ONLY).
*/
public start(intensity: number = 0.05, duration: number = 0.5, onComplete = null, force: boolean = true, direction: number = Shake.SHAKE_BOTH_AXES) {
public start(intensity: number = 0.05, duration: number = 0.5, onComplete = null, force: bool = true, direction: number = Shake.SHAKE_BOTH_AXES) {
if (!force && ((this._fxShakeOffset.x != 0) || (this._fxShakeOffset.y != 0)))
{
+4 -3
View File
@@ -20,6 +20,10 @@ Try out the [Phaser Test Suite](http://gametest.mobi/phaser/)
Known Issues
------------
* The TypeScript 0.9.1 compiler is NOT production ready and is full of bugs. I tried my best to support it but I can't in all honesty
recommend it to anyone, so have reverted back to TypeScript 0.8.3 which works flawlessly. Sorry everyone. I'll try upgrading again in
the future when they sort it out.
* Input detection on Sprites/Buttons doesn't work if the CAMERA is rotated or scaled.
Future Plans
@@ -48,8 +52,6 @@ ToDo before release
* Sprite.transform.bottomRight/Left doesn't seem to take origin into account
* When game paused should mute-all then resume-all sounds?
* Bitmap Font support
* Put ArcadePhysics back in
* Look at the N+ tile support maybe with ArcadePhysics?
* Pixel-perfect click check
* Check Flash atlas export is supported
* DynamicTexture.setPixel needs to be swapped for a proper pixel put, not the filledRect it currently is.
@@ -166,7 +168,6 @@ V1.0.0
* Added Sprite.transform.centerOn(x,y) to quickly center a sprite on a coordinate without messing with the sprite origin and regardless of rotation.
* Added Input.pollRate - this lets you limit how often Pointer events are handled (0 = every frame, 1 = every other frame, etc)
* Renamed the 'init' function to 'preload'. It now calls load.start automatically.
* Entire framework updated for TypeScript 0.9.1 - what a mammoth amount of work that was! Sorry but not backward compatible.
* Added CanvasUtils class, including ability to set image rendering, add a canvas to the dom and other handy things.
+1
View File
@@ -257,6 +257,7 @@
<TypeScriptCompile Include="scrollzones\parallax.ts" />
<TypeScriptCompile Include="scrollzones\ballscroller.ts" />
<TypeScriptCompile Include="physics\sprite bounds.ts" />
<TypeScriptCompile Include="physics\circle 1.ts" />
<Content Include="physics\sprite bounds.js">
<DependentUpon>sprite bounds.ts</DependentUpon>
</Content>
+10 -13
View File
@@ -4,40 +4,37 @@
//var PhaserGlobal = { disableWebAudio: true };
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
function preload() {
game.load.audio('rabbit', ['assets/mp3/peter_rabbit.m4a', 'assets/mp3/peter_rabbit.mp3', 'assets/mp3/peter_rabbit.ogg']);
game.load.audio('rabbit', [
'assets/mp3/peter_rabbit.m4a',
'assets/mp3/peter_rabbit.mp3',
'assets/mp3/peter_rabbit.ogg'
]);
game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71);
}
audioSprite:
Phaser.Sound;
Phaser.Sound
button:
Phaser.UI.Button;
Phaser.UI.Button
pause:
Phaser.UI.Button;
Phaser.UI.Button
function create() {
this.audioSprite = game.add.audio('rabbit');
this.audioSprite.addMarker('title', 3.00, 5.00, 1, true);
this.audioSprite.addMarker('help', 6.00, 12.00);
this.audioSprite.addMarker('intro', 14.00, 19.00);
this.audioSprite.addMarker('peter', 20.00, 21.50);
this.button = game.add.button(game.stage.centerX, 400, 'button', playMusic, this, 2, 1, 0);
//this.pause = game.add.button(200, 200, 'button', togglePause, this, 2, 1, 0);
}
}
function playMusic() {
this.audioSprite.play('help');
}
function render() {
Phaser.DebugUtils.renderSoundInfo(this.audioSprite, 32, 32);
}
function togglePause() {
if (this.music.paused) {
if(this.music.paused) {
this.music.resume();
} else {
this.music.pause();
+10 -17
View File
@@ -4,57 +4,50 @@
//var PhaserGlobal = { fakeiOSTouchLock: true, disableWebAudio: true };
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
function preload() {
//game.load.audio('wizball', ['assets/mp3/oedipus_wizball_highscore.ogg', 'assets/mp3/oedipus_wizball_highscore.mp3']);
game.load.audio('boden', ['assets/mp3/bodenstaendig_2000_in_rock_4bit.mp3']);
game.load.audio('boden', [
'assets/mp3/bodenstaendig_2000_in_rock_4bit.mp3'
]);
game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71);
}
button:
Phaser.UI.Button;
Phaser.UI.Button
music:
Phaser.Sound;
Phaser.Sound
volumeUp:
Phaser.UI.Button;
Phaser.UI.Button
volumeDown:
Phaser.UI.Button;
Phaser.UI.Button
pause:
Phaser.UI.Button;
Phaser.UI.Button
function create() {
this.music = game.add.audio('boden');
this.button = game.add.button(game.stage.centerX, 400, 'button', playMusic, this, 2, 1, 0);
//this.volumeUp = game.add.button(0, 0, 'button', volUp, this, 2, 1, 0);
//this.volumeDown = game.add.button(700, 0, 'button', volDown, this, 2, 1, 0);
//this.pause = game.add.button(200, 200, 'button', togglePause, this, 2, 1, 0);
}
}
function render() {
Phaser.DebugUtils.renderSoundInfo(this.music, 0, 300);
}
function togglePause() {
if (this.music.paused) {
if(this.music.paused) {
this.music.resume();
} else {
this.music.pause();
}
}
function volUp() {
//game.sound.volume += 0.1;
this.music.volume += 0.1;
console.log('vol up', game.sound.volume);
}
function volDown() {
//game.sound.volume -= 0.1;
this.music.volume -= 0.1;
console.log('vol down', game.sound.volume);
}
function playMusic() {
this.music.play();
}
+3 -9
View File
@@ -2,34 +2,28 @@
/// <reference path="../../Phaser/ui/Button.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create);
function preload() {
game.load.image('beast', 'assets/pics/shadow_of_the_beast2_other_world.png');
game.load.atlas('button', 'assets/buttons/button_texture_atlas.png', 'assets/buttons/button_texture_atlas.json');
}
image:
Phaser.Sprite;
Phaser.Sprite
button:
Phaser.UI.Button;
Phaser.UI.Button
function create() {
// This is just an image that we'll toggle the display of when you click the button
this.image = game.add.sprite(game.stage.centerX, 0, 'beast');
this.image.transform.origin.setTo(0.5, 0);
// This button is created from a texture atlas.
// Instead of frame IDs (like with a sprite sheet) we can tell it to use frame names instead.
// In this case our atlast frame names were called 'over', 'out' and 'down', but they could be anything you want.
// The function "clickedIt" will be called when the button is clicked or touched
this.button = game.add.button(game.stage.centerX, 400, 'button', clickedIt, this, 'over', 'out', 'down');
// Just makes the button origin set to the middle, we only do this to center the button on-screen, no other reason
this.button.transform.origin.setTo(0.5, 0.5);
}
function clickedIt() {
if (this.image.visible == true) {
if(this.image.visible == true) {
this.image.visible = false;
} else {
this.image.visible = true;
+3 -9
View File
@@ -2,35 +2,29 @@
/// <reference path="../../Phaser/ui/Button.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create);
function preload() {
game.load.image('beast', 'assets/pics/shadow_of_the_beast2_karamoon.png');
game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71);
}
image:
Phaser.Sprite;
Phaser.Sprite
button:
Phaser.UI.Button;
Phaser.UI.Button
function create() {
// This is just an image that we'll toggle the display of when you click the button
this.image = game.add.sprite(game.stage.centerX, 0, 'beast');
this.image.transform.origin.setTo(0.5, 0);
// This button is created from a sprite sheet.
// Frame 0 = the 'down' state
// Frame 1 = the 'out' state
// Frame 2 = the 'over' state
// The function "clickedIt" will be called when the button is clicked or touched
this.button = game.add.button(game.stage.centerX, 400, 'button', clickedIt, this, 2, 1, 0);
// Just makes the button origin set to the middle, we only do this to center the button on-screen, no other reason
this.button.transform.origin.setTo(0.5, 0.5);
}
function clickedIt() {
if (this.image.visible == true) {
if(this.image.visible == true) {
this.image.visible = false;
} else {
this.image.visible = true;
-7
View File
@@ -2,32 +2,25 @@
/// <reference path="../../Phaser/ui/Button.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
function preload() {
game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71);
}
var button;
var secondCam;
function create() {
button = game.add.button(200, 400, 'button', clickedIt, this, 2, 1, 0);
button.origin.setTo(0.5, 0.5);
game.camera.width = 400;
game.camera.texture.opaque = true;
game.camera.texture.backgroundColor = 'rgb(100,0,0)';
secondCam = game.add.camera(400, 0, 400, 600);
secondCam.texture.opaque = true;
secondCam.texture.backgroundColor = 'rgb(0,100,0)';
}
function render() {
Phaser.DebugUtils.renderInputInfo(32, 32);
Phaser.DebugUtils.renderSpriteWorldView(button, 32, 200);
}
function clickedIt() {
button.rotation += 10;
}
+3 -10
View File
@@ -2,39 +2,32 @@
/// <reference path="../../Phaser/ui/Button.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
function preload() {
game.load.image('beast', 'assets/pics/shadow_of_the_beast2_other_world.png');
game.load.atlas('button', 'assets/buttons/button_texture_atlas.png', 'assets/buttons/button_texture_atlas.json');
}
image:
Phaser.Sprite;
Phaser.Sprite
button:
Phaser.UI.Button;
Phaser.UI.Button
function create() {
// This is just an image that we'll toggle the display of when you click the button
this.image = game.add.sprite(game.stage.centerX, 0, 'beast');
this.image.transform.origin.setTo(0.5, 0);
// This button is created from a texture atlas.
// Instead of frame IDs (like with a sprite sheet) we can tell it to use frame names instead.
// In this case our atlast frame names were called 'over', 'out' and 'down', but they could be anything you want.
// The function "clickedIt" will be called when the button is clicked or touched
this.button = game.add.button(game.stage.centerX, 400, 'button', clickedIt, this, 'over', 'out', 'down');
// Makes the button origin set to the middle
this.button.transform.origin.setTo(0.5, 0.5);
}
function update() {
// Rotate the button each frame, the button states will still work and respond.
this.button.rotation += 1;
}
function clickedIt() {
if (this.image.visible == true) {
if(this.image.visible == true) {
this.image.visible = false;
} else {
this.image.visible = true;
+4 -13
View File
@@ -2,29 +2,22 @@
/// <reference path="../../Plugins/CameraFX/Mirror.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
function preload() {
game.load.image('backdrop', 'assets/pics/ninja-masters2.png');
}
var mirror;
function create() {
// Just set the world to be the size of the image we're loading in
game.world.setSize(1216, 896);
// What we need is a camera 800x400 pixels in size as the mirror effect will be 200px tall and sit below it.
// So we resize our default camera to 400px
game.camera.height = 400;
// Add our effect to the camera
mirror = game.camera.plugins.add(Phaser.Plugins.CameraFX.Mirror);
// The first 2 parameters are the x and y coordinates of where to display the effect. They are in STAGE coordinates, not World.
// The next is a Rectangle making up the region of the Camera that we'll create the effect from (in this case the whole camera).
// Finally we set the fill color that is put over the top of the mirror effect.
mirror.start(0, 400, new Phaser.Rectangle(0, 0, 800, 400), 'rgba(0, 0, 100, 0.7)');
// Experiment with variations on these to see the different mirror effects that can be achieved.
//mirror.flipX = true;
//mirror.flipY = true;
@@ -32,17 +25,15 @@
// just a single image, but when used on a full game it can look really quite neat.
game.add.sprite(0, 0, 'backdrop');
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
game.camera.x -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
game.camera.x += 4;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
game.camera.y -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
game.camera.y += 4;
}
}
+4 -13
View File
@@ -2,38 +2,29 @@
/// <reference path="../../Plugins/CameraFX/Scanlines.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
function preload() {
game.load.image('backdrop', 'assets/pics/ninja-masters2.png');
}
var scanlines;
function create() {
game.world.setSize(1216, 896);
// Add our effect to the camera
scanlines = game.camera.plugins.add(Phaser.Plugins.CameraFX.Scanlines);
// We'll have the scanlines spaced out every 2 pixels
scanlines.spacing = 2;
// This is the color the lines will be drawn in
scanlines.color = 'rgba(0, 0, 0, 0.8)';
game.add.sprite(0, 0, 'backdrop');
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
game.camera.x -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
game.camera.x += 4;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
game.camera.y -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
game.camera.y += 4;
}
}
+6 -15
View File
@@ -1,21 +1,16 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update, render);
function preload() {
game.load.image('backdrop', 'assets/pics/remember-me.jpg');
game.load.image('melon', 'assets/sprites/melon.png');
}
function create() {
game.world.setSize(1920, 1200, true);
game.add.sprite(0, 0, 'backdrop');
for (var i = 0; i < 100; i++) {
for(var i = 0; i < 100; i++) {
game.add.sprite(game.world.randomX, game.world.randomY, 'melon');
}
//game.camera.texture.alpha = 0.5;
//game.camera.width = 400;
game.camera.texture.opaque = true;
@@ -24,28 +19,24 @@
game.camera.setPosition(game.stage.centerX, game.stage.centerY);
//game.camera.setPosition(0, 0);
//console.log('cam', game.camera.width, game.camera.height);
}
}
function update() {
game.camera.rotation--;
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
//game.camera.x -= 4;
game.camera.transform.scale.x -= 0.1;
game.camera.transform.scale.y -= 0.1;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
//game.camera.x += 4;
game.camera.transform.scale.x += 0.1;
game.camera.transform.scale.y += 0.1;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
game.camera.y -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
game.camera.y += 4;
}
}
function render() {
Phaser.DebugUtils.renderCameraInfo(game.camera, 32, 32);
}
+4 -9
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update);
var ufo;
var speed = 4;
function preload() {
game.world.setSize(1280, 600, true);
game.load.image('ground', 'assets/tests/ground-2x.png');
@@ -13,7 +11,6 @@
game.load.image('cloud0', 'assets/tests/cloud-big-2x.png');
game.load.image('cloud1', 'assets/tests/cloud-narrow-2x.png');
game.load.image('cloud2', 'assets/tests/cloud-small-2x.png');
game.load.spritesheet('ufo', 'assets/sprites/ufo.png', 24, 21);
}
function create() {
@@ -24,29 +21,27 @@
game.add.sprite(200, 120, 'cloud0').transform.scrollFactor.setTo(0.3, 0.3);
game.add.sprite(-60, 120, 'cloud1').transform.scrollFactor.setTo(0.5, 0.3);
game.add.sprite(900, 170, 'cloud2').transform.scrollFactor.setTo(0.7, 0.3);
// ufo spirte
ufo = game.add.sprite(320, 240, 'ufo');
ufo.animations.add('fly', null, 30, false);
ufo.animations.play('fly');
ufo.transform.origin.setTo(0.5, 0.5);
// make camera follows ufo
game.camera.follow(ufo);
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
ufo.x -= speed;
ufo.rotation = -15;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
ufo.x += speed;
ufo.rotation = 15;
} else {
ufo.rotation = 0;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
ufo.y -= speed;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
ufo.y += speed;
}
}
+5 -15
View File
@@ -1,40 +1,31 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update, render);
function preload() {
game.load.image('grid', 'assets/tests/debug-grid-1920x1920.png');
game.load.image('car', 'assets/sprites/car90.png');
}
var car;
var miniCam;
function create() {
game.world.setSize(2240, 2240, true);
game.add.sprite(0, 0, 'grid');
car = game.add.sprite(400, 300, 'car');
game.camera.follow(car, Phaser.Types.CAMERA_FOLLOW_TOPDOWN);
miniCam = game.add.camera(0, 0, 300, 300);
miniCam.follow(car, Phaser.Types.CAMERA_FOLLOW_TOPDOWN_TIGHT);
miniCam.setBounds(0, 0, game.world.width, game.world.height);
miniCam.texture.alpha = 0.7;
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
car.x -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
car.x += 4;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
car.y -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
car.y += 4;
}
/*
@@ -59,8 +50,7 @@
car.velocity.copyFrom(motion);
}
*/
}
}
function render() {
Phaser.DebugUtils.renderSpriteInfo(car, 32, 32);
Phaser.DebugUtils.renderCameraInfo(game.camera, 32, 300);
+1 -3
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
var btn1, btn2, btn3;
var fx;
function preload() {
game.world.setSize(800, 600, true);
game.load.image('blue', 'assets/tests/blue-circle.png');
@@ -16,7 +14,7 @@
btn2 = game.add.button(426, 86, 'yellow', forceFade, this);
btn3 = game.add.button(221, 318, 'magenta', fadeWithCallback, this);
//fx = game.camera.fx.add(Phaser.FX.Camera.Fade);
}
}
function render() {
Phaser.DebugUtils.context.fillStyle = '#fff';
Phaser.DebugUtils.context.fillText('Press to fade.', 114 + 90, 34 + 130);
+1 -3
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
var btn1, btn2, btn3;
var fx;
function preload() {
game.world.setSize(800, 600, true);
game.load.image('blue', 'assets/tests/blue-circle.png');
@@ -17,7 +15,7 @@
btn3 = game.add.button(221, 318, 'magenta', flashWithCallback, this);
// Usage of flash fx is the same as fade.
//fx = game.camera.fx.add(Phaser.FX.Camera.Flash);
}
}
function render() {
Phaser.DebugUtils.context.fillStyle = '#fff';
Phaser.DebugUtils.context.fillText('Press to flash.', 114 + 90, 34 + 130);
+1 -3
View File
@@ -1,10 +1,8 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, null, render);
var btn1, btn2, btn3;
var fx;
function preload() {
game.world.setSize(800, 600, true);
game.load.image('blue', 'assets/tests/blue-circle.png');
@@ -17,7 +15,7 @@
btn3 = game.add.button(221, 318, 'magenta', shakeWithCallback, this);
// Usage of shake fx is the same as fade and flash.
//fx = game.camera.fx.add(Phaser.FX.Camera.Shake);
}
}
function render() {
Phaser.DebugUtils.context.fillStyle = '#fff';
Phaser.DebugUtils.context.fillText('Press to shake.', 114 + 90, 34 + 130);
+5 -14
View File
@@ -1,45 +1,36 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update, render);
function preload() {
game.load.image('melon', 'assets/sprites/melon.png');
}
var car;
var miniCam;
function create() {
game.world.setSize(3000, 3000, true);
game.stage.backgroundColor = 'rgb(20,20,50)';
for (var i = 0; i < 1000; i++) {
for(var i = 0; i < 1000; i++) {
game.add.sprite(game.world.randomX, game.world.randomY, 'melon');
}
game.camera.transform.origin.setTo(0.5, 0.5);
game.camera.texture.opaque = true;
game.camera.texture.backgroundColor = 'rgb(0,0,0)';
game.camera.setPosition(game.stage.centerX, game.stage.centerY);
//game.camera.setPosition(200, 0);
game.camera.setSize(320, 320);
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
game.camera.rotation -= 2;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
game.camera.rotation += 2;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
game.camera.y -= 4;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
game.camera.y += 4;
}
}
function render() {
Phaser.DebugUtils.renderCameraInfo(game.camera, 32, 32);
}
+5 -17
View File
@@ -1,18 +1,14 @@
/// <reference path="../../Phaser/Game.ts" />
(function () {
var game = new Phaser.Game(this, 'game', 800, 600, preload, create, update, render);
var zombieCamera;
var zombie;
var walkSpeed = 2, direction = 1;
function preload() {
game.world.setSize(1280, 600, true);
game.load.image('ground', 'assets/tests/ground-2x.png');
game.load.image('river', 'assets/tests/river-2x.png');
game.load.image('sky', 'assets/tests/sky-2x.png');
game.load.spritesheet('zombie', 'assets/sprites/metalslug_monster39x40.png', 39, 40);
}
function create() {
@@ -20,48 +16,40 @@
game.add.sprite(0, 0, 'sky');
game.add.sprite(0, 360, 'ground');
game.add.sprite(0, 400, 'river');
// Create zombie spirte
zombie = game.add.sprite(480, 336, 'zombie');
zombie.animations.add('walk', null, 30, true);
zombie.animations.play('walk');
// Create a small camera which looks at the zombie.
// Use the same settings as the default camera.
zombieCamera = game.add.camera(0, 0, 800, 600);
// Use x and y properties to set the target area.
zombieCamera.x = 420;
zombieCamera.y = 240;
// Resize the camera so that it will only look at 200x200 area.
zombieCamera.setSize(200, 200);
// Scale the camera to 2.0, now its target will be 100x100.
zombieCamera.transform.scale.setTo(2.0, 2.0);
// Use setPosition() method to set where the camera rendered
// on the screen.
zombieCamera.setPosition(0, 0);
}
function update() {
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) {
zombieCamera.x -= 2;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) {
zombieCamera.x += 2;
}
if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
if(game.input.keyboard.isDown(Phaser.Keyboard.UP)) {
zombieCamera.y -= 2;
} else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
} else if(game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) {
zombieCamera.y += 2;
}
// zombie wandering update
zombie.x += walkSpeed * direction;
if (zombie.x > 540 || zombie.x < 440) {
if(zombie.x > 540 || zombie.x < 440) {
// Change walk direction.
direction *= -1;
// Flip zombie's animation.
zombie.texture.flippedX = !zombie.texture.flippedX;
}

Some files were not shown because too many files have changed in this diff Show More