More Group fixes to the new format. Updated list of included Pixi files to remove un-needed ones.

This commit is contained in:
photonstorm 2014-02-06 03:34:27 +00:00
parent 4cfce8b4d2
commit 8eae8feecc
12 changed files with 320 additions and 174 deletions

View file

@ -6,6 +6,41 @@
$path = '..';
}
/*
<script src="$path/src/pixi/InteractionData.js"></script>
<script src="$path/src/pixi/InteractionManager.js"></script>
<script src="$path/src/pixi/loaders/AssetLoader.js"></script>
<script src="$path/src/pixi/loaders/JsonLoader.js"></script>
<script src="$path/src/pixi/loaders/AtlasLoader.js"></script>
<script src="$path/src/pixi/loaders/SpriteSheetLoader.js"></script>
<script src="$path/src/pixi/loaders/ImageLoader.js"></script>
<script src="$path/src/pixi/loaders/BitmapFontLoader.js"></script>
<script src="$path/src/pixi/loaders/SpineLoader.js"></script>
<script src="$path/src/pixi/filters/AbstractFilter.js"></script>
<script src="$path/src/pixi/filters/AlphaMaskFilter.js"></script>
<script src="$path/src/pixi/filters/ColorMatrixFilter.js"></script>
<script src="$path/src/pixi/filters/GrayFilter.js"></script>
<script src="$path/src/pixi/filters/DisplacementFilter.js"></script>
<script src="$path/src/pixi/filters/PixelateFilter.js"></script>
<script src="$path/src/pixi/filters/BlurXFilter.js"></script>
<script src="$path/src/pixi/filters/BlurYFilter.js"></script>
<script src="$path/src/pixi/filters/BlurFilter.js"></script>
<script src="$path/src/pixi/filters/InvertFilter.js"></script>
<script src="$path/src/pixi/filters/SepiaFilter.js"></script>
<script src="$path/src/pixi/filters/TwistFilter.js"></script>
<script src="$path/src/pixi/filters/ColorStepFilter.js"></script>
<script src="$path/src/pixi/filters/DotScreenFilter.js"></script>
<script src="$path/src/pixi/filters/CrossHatchFilter.js"></script>
<script src="$path/src/pixi/filters/RGBSplitFilter.js"></script>
<script src="$path/src/pixi/extras/Spine.js"></script>
<script src="$path/src/pixi/utils/Utils.js"></script>
*/
echo <<<EOL
<script src="$path/src/Intro.js"></script>
@ -28,10 +63,7 @@
<script src="$path/src/pixi/filters/FilterBlock.js"></script>
<script src="$path/src/pixi/text/Text.js"></script>
<script src="$path/src/pixi/text/BitmapText.js"></script>
<script src="$path/src/pixi/InteractionData.js"></script>
<script src="$path/src/pixi/InteractionManager.js"></script>
<script src="$path/src/pixi/display/Stage.js"></script>
<script src="$path/src/pixi/utils/Utils.js"></script>
<script src="$path/src/pixi/utils/EventTarget.js"></script>
<script src="$path/src/pixi/utils/Detector.js"></script>
<script src="$path/src/pixi/utils/Polyk.js"></script>
@ -56,33 +88,9 @@
<script src="$path/src/pixi/extras/Strip.js"></script>
<script src="$path/src/pixi/extras/Rope.js"></script>
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
<script src="$path/src/pixi/extras/Spine.js"></script>
<script src="$path/src/pixi/textures/BaseTexture.js"></script>
<script src="$path/src/pixi/textures/Texture.js"></script>
<script src="$path/src/pixi/textures/RenderTexture.js"></script>
<script src="$path/src/pixi/loaders/AssetLoader.js"></script>
<script src="$path/src/pixi/loaders/JsonLoader.js"></script>
<script src="$path/src/pixi/loaders/AtlasLoader.js"></script>
<script src="$path/src/pixi/loaders/SpriteSheetLoader.js"></script>
<script src="$path/src/pixi/loaders/ImageLoader.js"></script>
<script src="$path/src/pixi/loaders/BitmapFontLoader.js"></script>
<script src="$path/src/pixi/loaders/SpineLoader.js"></script>
<script src="$path/src/pixi/filters/AbstractFilter.js"></script>
<script src="$path/src/pixi/filters/AlphaMaskFilter.js"></script>
<script src="$path/src/pixi/filters/ColorMatrixFilter.js"></script>
<script src="$path/src/pixi/filters/GrayFilter.js"></script>
<script src="$path/src/pixi/filters/DisplacementFilter.js"></script>
<script src="$path/src/pixi/filters/PixelateFilter.js"></script>
<script src="$path/src/pixi/filters/BlurXFilter.js"></script>
<script src="$path/src/pixi/filters/BlurYFilter.js"></script>
<script src="$path/src/pixi/filters/BlurFilter.js"></script>
<script src="$path/src/pixi/filters/InvertFilter.js"></script>
<script src="$path/src/pixi/filters/SepiaFilter.js"></script>
<script src="$path/src/pixi/filters/TwistFilter.js"></script>
<script src="$path/src/pixi/filters/ColorStepFilter.js"></script>
<script src="$path/src/pixi/filters/DotScreenFilter.js"></script>
<script src="$path/src/pixi/filters/CrossHatchFilter.js"></script>
<script src="$path/src/pixi/filters/RGBSplitFilter.js"></script>
<script src="$path/src/core/Camera.js"></script>
<script src="$path/src/core/State.js"></script>

View file

@ -17,48 +17,76 @@
<script src="../src/Phaser.js"></script>
<script src="../src/utils/Utils.js"></script>
<script src="../src/pixi/core/Matrix.js"></script>
<script src="../src/pixi/Pixi.js"></script>
<script src="../src/pixi/core/Point.js"></script>
<script src="../src/pixi/core/Rectangle.js"></script>
<script src="../src/pixi/core/Polygon.js"></script>
<script src="../src/pixi/core/Circle.js"></script>
<script src="../src/pixi/core/Ellipse.js"></script>
<script src="../src/pixi/core/Matrix.js"></script>
<script src="../src/pixi/display/DisplayObject.js"></script>
<script src="../src/pixi/display/DisplayObjectContainer.js"></script>
<script src="../src/pixi/display/Sprite.js"></script>
<script src="../src/pixi/display/SpriteBatch.js"></script>
<script src="../src/pixi/display/MovieClip.js"></script>
<script src="../src/pixi/filters/FilterBlock.js"></script>
<script src="../src/pixi/text/Text.js"></script>
<script src="../src/pixi/text/BitmapText.js"></script>
<script src="../src/pixi/InteractionData.js"></script>
<script src="../src/pixi/InteractionManager.js"></script>
<script src="../src/pixi/display/Stage.js"></script>
<script src="../src/pixi/extras/CustomRenderable.js"></script>
<script src="../src/pixi/utils/Utils.js"></script>
<script src="../src/pixi/utils/EventTarget.js"></script>
<script src="../src/pixi/utils/Detector.js"></script>
<script src="../src/pixi/utils/Polyk.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/StripShader.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
<script src="../src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
<script src="../src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
<script src="../src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="../src/pixi/primitives/Graphics.js"></script>
<script src="../src/pixi/extras/Strip.js"></script>
<script src="../src/pixi/extras/Rope.js"></script>
<script src="../src/pixi/extras/TilingSprite.js"></script>
<script src="../src/pixi/filters/AbstractFilter.js"></script>
<script src="../src/pixi/filters/FilterBlock.js"></script>
<script src="../src/pixi/primitives/Graphics.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/PixiShader.js"></script>
<script src="../src/pixi/renderers/webgl/PrimitiveShader.js"></script>
<script src="../src/pixi/renderers/webgl/StripShader.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLBatch.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLFilterManager.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLGraphics.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderGroup.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLShaders.js"></script>
<script src="../src/pixi/text/BitmapText.js"></script>
<script src="../src/pixi/text/Text.js"></script>
<script src="../src/pixi/extras/Spine.js"></script>
<script src="../src/pixi/textures/BaseTexture.js"></script>
<script src="../src/pixi/textures/Texture.js"></script>
<script src="../src/pixi/textures/RenderTexture.js"></script>
<script src="../src/pixi/utils/EventTarget.js"></script>
<script src="../src/pixi/utils/Polyk.js"></script>
<script src="../src/pixi/loaders/AssetLoader.js"></script>
<script src="../src/pixi/loaders/JsonLoader.js"></script>
<script src="../src/pixi/loaders/AtlasLoader.js"></script>
<script src="../src/pixi/loaders/SpriteSheetLoader.js"></script>
<script src="../src/pixi/loaders/ImageLoader.js"></script>
<script src="../src/pixi/loaders/BitmapFontLoader.js"></script>
<script src="../src/pixi/loaders/SpineLoader.js"></script>
<script src="../src/pixi/filters/AbstractFilter.js"></script>
<script src="../src/pixi/filters/AlphaMaskFilter.js"></script>
<script src="../src/pixi/filters/ColorMatrixFilter.js"></script>
<script src="../src/pixi/filters/GrayFilter.js"></script>
<script src="../src/pixi/filters/DisplacementFilter.js"></script>
<script src="../src/pixi/filters/PixelateFilter.js"></script>
<script src="../src/pixi/filters/BlurXFilter.js"></script>
<script src="../src/pixi/filters/BlurYFilter.js"></script>
<script src="../src/pixi/filters/BlurFilter.js"></script>
<script src="../src/pixi/filters/InvertFilter.js"></script>
<script src="../src/pixi/filters/SepiaFilter.js"></script>
<script src="../src/pixi/filters/TwistFilter.js"></script>
<script src="../src/pixi/filters/ColorStepFilter.js"></script>
<script src="../src/pixi/filters/DotScreenFilter.js"></script>
<script src="../src/pixi/filters/CrossHatchFilter.js"></script>
<script src="../src/pixi/filters/RGBSplitFilter.js"></script>
<script src="../src/core/Camera.js"></script>
<script src="../src/core/State.js"></script>
@ -66,10 +94,10 @@
<script src="../src/core/LinkedList.js"></script>
<script src="../src/core/Signal.js"></script>
<script src="../src/core/SignalBinding.js"></script>
<script src="../src/core/Filter.js"></script>
<script src="../src/core/Plugin.js"></script>
<script src="../src/core/PluginManager.js"></script>
<script src="../src/core/Stage.js"></script>
<script src="../src/core/Filter.js"></script>
<script src="../src/core/Group.js"></script>
<script src="../src/core/World.js"></script>
<script src="../src/core/Game.js"></script>
@ -106,10 +134,10 @@
<script src="../src/math/Math.js"></script>
<script src="../src/math/QuadTree.js"></script>
<script src="../src/geom/Line.js"></script>
<script src="../src/geom/Circle.js"></script>
<script src="../src/geom/Point.js"></script>
<script src="../src/geom/Rectangle.js"></script>
<script src="../src/geom/Line.js"></script>
<script src="../src/net/Net.js"></script>
@ -151,8 +179,6 @@
<script src="../src/tilemap/TilemapParser.js"></script>
<script src="../src/tilemap/Tileset.js"></script>
<script src="../src/PixiPatch.js"></script>
<script src="_site/js/phaser-viewer.js" type="text/javascript"></script>
<script src="_site/js/run_prettify.js"></script>
<link href="_site/css/phaser-examples.css" media="screen" rel="stylesheet" type="text/css">
@ -163,7 +189,7 @@
<div class="header">
<div class="box100 no-padding">
<div class="phaser-version">
<span>Phaser Version: 1.1.4</span>
<span>Phaser Version: 1.2</span>
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
</div>
</div>

View file

@ -10,55 +10,83 @@
<!--
If you're wondering why we embed each script separately, and not just the single-file phaser lib
it's because it makes debugging *significantly* easier for us. Feel free to replace all the below
with just a call to ../dist/phaser.js instead if you prefer.
with just a call to ../build/phaser.js instead if you prefer.
-->
<script src="../src/Intro.js"></script>
<script src="../src/pixi/Pixi.js"></script>
<script src="../src/Phaser.js"></script>
<script src="../src/utils/Utils.js"></script>
<script src="../src/pixi/core/Matrix.js"></script>
<script src="../src/pixi/Pixi.js"></script>
<script src="../src/pixi/core/Point.js"></script>
<script src="../src/pixi/core/Rectangle.js"></script>
<script src="../src/pixi/core/Polygon.js"></script>
<script src="../src/pixi/core/Circle.js"></script>
<script src="../src/pixi/core/Ellipse.js"></script>
<script src="../src/pixi/core/Matrix.js"></script>
<script src="../src/pixi/display/DisplayObject.js"></script>
<script src="../src/pixi/display/DisplayObjectContainer.js"></script>
<script src="../src/pixi/display/Sprite.js"></script>
<script src="../src/pixi/display/SpriteBatch.js"></script>
<script src="../src/pixi/display/MovieClip.js"></script>
<script src="../src/pixi/filters/FilterBlock.js"></script>
<script src="../src/pixi/text/Text.js"></script>
<script src="../src/pixi/text/BitmapText.js"></script>
<script src="../src/pixi/InteractionData.js"></script>
<script src="../src/pixi/InteractionManager.js"></script>
<script src="../src/pixi/display/Stage.js"></script>
<script src="../src/pixi/extras/CustomRenderable.js"></script>
<script src="../src/pixi/utils/Utils.js"></script>
<script src="../src/pixi/utils/EventTarget.js"></script>
<script src="../src/pixi/utils/Detector.js"></script>
<script src="../src/pixi/utils/Polyk.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLShaderUtils.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/PixiShader.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/PixiFastShader.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/StripShader.js"></script>
<script src="../src/pixi/renderers/webgl/shaders/PrimitiveShader.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLGraphics.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLMaskManager.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLShaderManager.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLSpriteBatch.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLFastSpriteBatch.js"></script>
<script src="../src/pixi/renderers/webgl/utils/WebGLFilterManager.js"></script>
<script src="../src/pixi/renderers/webgl/utils/FilterTexture.js"></script>
<script src="../src/pixi/renderers/canvas/utils/CanvasMaskManager.js"></script>
<script src="../src/pixi/renderers/canvas/utils/CanvasTinter.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="../src/pixi/primitives/Graphics.js"></script>
<script src="../src/pixi/extras/Strip.js"></script>
<script src="../src/pixi/extras/Rope.js"></script>
<script src="../src/pixi/extras/TilingSprite.js"></script>
<script src="../src/pixi/filters/AbstractFilter.js"></script>
<script src="../src/pixi/filters/FilterBlock.js"></script>
<script src="../src/pixi/primitives/Graphics.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasGraphics.js"></script>
<script src="../src/pixi/renderers/canvas/CanvasRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/PixiShader.js"></script>
<script src="../src/pixi/renderers/webgl/PrimitiveShader.js"></script>
<script src="../src/pixi/renderers/webgl/StripShader.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLBatch.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLFilterManager.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLGraphics.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderer.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLRenderGroup.js"></script>
<script src="../src/pixi/renderers/webgl/WebGLShaders.js"></script>
<script src="../src/pixi/text/BitmapText.js"></script>
<script src="../src/pixi/text/Text.js"></script>
<script src="../src/pixi/extras/Spine.js"></script>
<script src="../src/pixi/textures/BaseTexture.js"></script>
<script src="../src/pixi/textures/Texture.js"></script>
<script src="../src/pixi/textures/RenderTexture.js"></script>
<script src="../src/pixi/utils/EventTarget.js"></script>
<script src="../src/pixi/utils/Polyk.js"></script>
<script src="../src/pixi/loaders/AssetLoader.js"></script>
<script src="../src/pixi/loaders/JsonLoader.js"></script>
<script src="../src/pixi/loaders/AtlasLoader.js"></script>
<script src="../src/pixi/loaders/SpriteSheetLoader.js"></script>
<script src="../src/pixi/loaders/ImageLoader.js"></script>
<script src="../src/pixi/loaders/BitmapFontLoader.js"></script>
<script src="../src/pixi/loaders/SpineLoader.js"></script>
<script src="../src/pixi/filters/AbstractFilter.js"></script>
<script src="../src/pixi/filters/AlphaMaskFilter.js"></script>
<script src="../src/pixi/filters/ColorMatrixFilter.js"></script>
<script src="../src/pixi/filters/GrayFilter.js"></script>
<script src="../src/pixi/filters/DisplacementFilter.js"></script>
<script src="../src/pixi/filters/PixelateFilter.js"></script>
<script src="../src/pixi/filters/BlurXFilter.js"></script>
<script src="../src/pixi/filters/BlurYFilter.js"></script>
<script src="../src/pixi/filters/BlurFilter.js"></script>
<script src="../src/pixi/filters/InvertFilter.js"></script>
<script src="../src/pixi/filters/SepiaFilter.js"></script>
<script src="../src/pixi/filters/TwistFilter.js"></script>
<script src="../src/pixi/filters/ColorStepFilter.js"></script>
<script src="../src/pixi/filters/DotScreenFilter.js"></script>
<script src="../src/pixi/filters/CrossHatchFilter.js"></script>
<script src="../src/pixi/filters/RGBSplitFilter.js"></script>
<script src="../src/core/Camera.js"></script>
<script src="../src/core/State.js"></script>
@ -66,9 +94,9 @@
<script src="../src/core/LinkedList.js"></script>
<script src="../src/core/Signal.js"></script>
<script src="../src/core/SignalBinding.js"></script>
<script src="../src/core/Filter.js"></script>
<script src="../src/core/Plugin.js"></script>
<script src="../src/core/PluginManager.js"></script>
<script src="../src/core/Filter.js"></script>
<script src="../src/core/Stage.js"></script>
<script src="../src/core/Group.js"></script>
<script src="../src/core/World.js"></script>
@ -106,10 +134,10 @@
<script src="../src/math/Math.js"></script>
<script src="../src/math/QuadTree.js"></script>
<script src="../src/geom/Line.js"></script>
<script src="../src/geom/Circle.js"></script>
<script src="../src/geom/Point.js"></script>
<script src="../src/geom/Rectangle.js"></script>
<script src="../src/geom/Line.js"></script>
<script src="../src/net/Net.js"></script>
@ -151,7 +179,6 @@
<script src="../src/tilemap/TilemapParser.js"></script>
<script src="../src/tilemap/Tileset.js"></script>
<script src="../src/PixiPatch.js"></script>
<script src="_site/js/phaser-viewer.js" type="text/javascript"></script>
</head>
<body>

Binary file not shown.

View file

@ -10,6 +10,7 @@ function preload() {
game.load.image('bg', 'assets/skies/sky2.png');
game.load.image('vulkaiser', 'assets/pics/vulkaiser_red.png');
game.load.binary('shampoo', 'assets/audio/protracker/shampoo.mod', modLoaded, this);
game.load.binary('macrocosm', 'assets/audio/protracker/macrocosm.mod', modLoaded, this);
game.load.binary('impulse', 'assets/audio/protracker/act_of_impulse.mod', modLoaded, this);
game.load.binary('enigma', 'assets/audio/protracker/enigma.mod', modLoaded, this);
@ -66,7 +67,7 @@ function create() {
vu4.width = 0;
module = new Protracker();
module.buffer = game.cache.getBinary('macrocosm');
module.buffer = game.cache.getBinary('shampoo');
module.parse();
module.play();

View file

@ -31,7 +31,7 @@ function create() {
// Now let's create some random sprites and enable them all for drag and 'bring to top'
for (var i = 0; i < 10; i++)
{
var tempSprite = game.add.sprite(game.stage.randomX, game.stage.randomY, 'atari1');
var tempSprite = game.add.sprite(game.world.randomX, game.world.randomY, 'atari1');
tempSprite.name = 'atari' + i;
tempSprite.input.start(i, true);
@ -41,7 +41,7 @@ function create() {
// Sonics
var tempSprite=game.add.sprite(game.stage.randomX, game.stage.randomY, 'sonic');
var tempSprite=game.add.sprite(game.world.randomX, game.world.randomY, 'sonic');
tempSprite.name = 'sonic' + i;
tempSprite.input.start(10 + i, true);

View file

@ -12,7 +12,7 @@
<div class="header">
<div class="box100 no-padding">
<div class="phaser-version">
<span>Phaser Version: 1.1.4</span>
<span>Phaser Version: 1.2</span>
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
</div>
</div>
@ -57,7 +57,7 @@
<div class="line">
<div class="box20">
<a href="http://www.photonstorm.com" class="photonstorm-logo"></a>
&copy; 2013 Photon Storm Ltd.<br/>
&copy; 2014 Photon Storm Ltd.<br/>
All rights reserved.
</div>
<div class="box5">

View file

@ -19,7 +19,7 @@
</div>
<div id="footer">
<p id="total">Total examples: </p>
<p>Phaser version: 1.1.4</p>
<p>Phaser version: 1.2</p>
<p><a href="index.html">Switch to Full View</a></p>
</div>

View file

@ -26,6 +26,8 @@ function create() {
game.input.onDown.add(tint, this);
game.add.tween(sprite).to({y: 500}, 3000, Phaser.Easing.Linear.None, true);
}
function tint() {

88
examples/wip/pixi2.js Normal file
View file

@ -0,0 +1,88 @@
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
function preload() {
game.load.image('beast', 'assets/pics/shadow_of_the_beast2_karamoon.png');
game.load.image('snot', 'assets/pics/nslide_snot.png');
game.load.image('atari1', 'assets/sprites/atari130xe.png');
game.load.image('sonic', 'assets/sprites/sonic_havok_sanity.png');
game.load.image('coke', 'assets/sprites/cokecan.png');
game.load.image('disk', 'assets/sprites/oz_pov_melting_disk.png');
}
var group1;
var group2;
var coke;
var disk;
function create() {
// Create a background image
game.add.sprite(0, 0, 'beast');
// Create a Group that will sit above the background image
group1 = game.add.group();
// Create a Group that will sit above Group 1
group2 = game.add.group();
// Now let's create some random sprites and enable them all for drag and 'bring to top'
for (var i = 0; i < 10; i++)
{
var tempSprite = game.add.sprite(game.world.randomX, game.world.randomY, 'atari1');
tempSprite.name = 'atari' + i;
tempSprite.input.start(i, true);
tempSprite.input.enableDrag(false, true);
group1.add(tempSprite);
// Sonics
var tempSprite=game.add.sprite(game.world.randomX, game.world.randomY, 'sonic');
tempSprite.name = 'sonic' + i;
tempSprite.input.start(10 + i, true);
tempSprite.input.enableDrag(false, true);
group2.add(tempSprite);
}
// Add 2 control sprites into each group - these cannot be dragged but should be bought to the top each time
coke = group1.create(100, 100, 'coke');
disk = group2.create(400, 300, 'disk');
// Create a foreground image - everything should appear behind this, even when dragged
var snot = game.add.sprite(game.world.centerX, game.world.height, 'snot');
snot.anchor.setTo(0.5, 1);
// You can click and drag any sprite but Sonic sprites should always appear above the Atari sprites
// and both types of sprite should only ever appear above the background and behind the
game.input.onDown.add(wibble, this);
}
function wibble(p) {
console.log(p);
}
function update() {
if (game.input.keyboard.justReleased(Phaser.Keyboard.ONE))
{
coke.bringToTop();
}
if (game.input.keyboard.justReleased(Phaser.Keyboard.TWO))
{
disk.bringToTop();
}
}
function render() {
game.debug.renderInputInfo(32, 32);
}

View file

@ -10,9 +10,9 @@
* @classdesc A Group is a container for display objects that allows for fast pooling, recycling and collision checks.
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {*} parent - The parent Group, DisplayObject or DisplayObjectContainer that will hold this group. If undefined it will use game.world.
* @param {*} parent - The parent Group, DisplayObject or DisplayObjectContainer that this Group will be added to. If undefined or null it will use game.world.
* @param {string} [name=group] - A name for this Group. Not used internally but useful for debugging.
* @param {boolean} [useStage=false] - Should the DisplayObjectContainer this Group creates be added to the World (default, false) or direct to the Stage (true).
* @param {boolean} [useStage=false] - Should this Group be added to the World (default, false) or direct to the Stage (true).
*/
Phaser.Group = function (game, parent, name, useStage) {
@ -21,7 +21,7 @@ Phaser.Group = function (game, parent, name, useStage) {
*/
this.game = game;
if (typeof parent === 'undefined')
if (typeof parent === 'undefined' || parent === null)
{
parent = game.world;
}
@ -34,34 +34,20 @@ Phaser.Group = function (game, parent, name, useStage) {
PIXI.DisplayObjectContainer.call(this);
if (typeof useStage === 'undefined')
{
useStage = false;
}
if (useStage)
{
// this._container = this.game.stage._stage;
}
else
{
if (parent)
{
// if (parent instanceof Phaser.Group)
// {
// parent.addChild(this);
// }
// else
// {
parent.addChild(this);
// parent.updateTransform();
// }
}
else
{
this.game.stage._stage.addChild(this);
// this.game.stage._stage.updateTransform();
}
}
else
{
this.game.stage._stage.addChild(this);
}
/**
* @property {number} type - Internal Phaser Type value.
@ -86,18 +72,14 @@ Phaser.Group = function (game, parent, name, useStage) {
*/
this.group = null;
// Replaces the PIXI.Point with a slightly more flexible one.
// this._container.scale = new Phaser.Point(1, 1);
/**
* @property {Phaser.Point} scale - The scane of the Group container.
* @property {Phaser.Point} scale - The scale of the Group container.
*/
// this.scale = this._container.scale;
this.scale = new Phaser.Point(1, 1);
/**
* @property {Phaser.Point} pivot - The pivot point of the Group container.
*/
// this.pivot = this._container.pivot;
/**
* The cursor is a simple way to iterate through the objects in a Group using the Group.next and Group.previous functions.
@ -164,8 +146,6 @@ Phaser.Group.prototype.add = function (child) {
this.addChild(child);
// child.updateTransform();
if (child.events)
{
child.events.onAddedToGroup.dispatch(child, this);
@ -198,8 +178,6 @@ Phaser.Group.prototype.addAt = function (child, index) {
this.addChildAt(child, index);
// child.updateTransform();
if (child.events)
{
child.events.onAddedToGroup.dispatch(child, this);
@ -253,8 +231,6 @@ Phaser.Group.prototype.create = function (x, y, key, frame, exists) {
this.addChild(child);
// child.updateTransform();
if (child.events)
{
child.events.onAddedToGroup.dispatch(child, this);
@ -295,8 +271,6 @@ Phaser.Group.prototype.createMultiple = function (quantity, key, frame, exists)
this.addChild(child);
// child.updateTransform();
if (child.events)
{
child.events.onAddedToGroup.dispatch(child, this);
@ -433,7 +407,6 @@ Phaser.Group.prototype.replace = function (oldChild, newChild) {
this.addChildAt(newChild, index);
newChild.events.onAddedToGroup.dispatch(newChild, this);
// newChild.updateTransform();
if (this.cursor === oldChild)
{
@ -860,41 +833,10 @@ Phaser.Group.prototype.sort = function (index, order) {
if (typeof index === 'undefined') { index = 'y'; }
if (typeof order === 'undefined') { order = Phaser.Group.SORT_ASCENDING; }
/*
var swapped;
var temp;
do {
}
swapped = false;
for (var i = 0, len = this._container.children.length - 1; i < len; i++)
{
if (order == Phaser.Group.SORT_ASCENDING)
{
if (this._container.children[i][index] > this._container.children[i + 1][index])
{
this.swap(this.getAt(i), this.getAt(i + 1));
temp = this._container.children[i];
this._container.children[i] = this._container.children[i + 1];
this._container.children[i + 1] = temp;
swapped = true;
}
}
else
{
if (this._container.children[i][index] < this._container.children[i + 1][index])
{
this.swap(this.getAt(i), this.getAt(i + 1));
temp = this._container.children[i];
this._container.children[i] = this._container.children[i + 1];
this._container.children[i + 1] = temp;
swapped = true;
}
}
}
} while (swapped);
*/
Phaser.Group.prototype.sortHandler = function (a, b) {
}

View file

@ -197,12 +197,64 @@ Phaser.Utils = {
};
function HEXtoRGB(hex) {
/**
* Converts a hex color number to an [R, G, B] array
*
* @method hex2rgb
* @param hex {Number}
*/
PIXI.hex2rgb = function(hex) {
return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255];
}
};
PIXI.hex2rgb = function hex2rgb(hex) {
return [(hex >> 16 & 0xFF) / 255, ( hex >> 8 & 0xFF) / 255, (hex & 0xFF)/ 255];
/**
* Converts a color as an [R, G, B] array to a hex number
*
* @method rgb2hex
* @param rgb {Array}
*/
PIXI.rgb2hex = function(rgb) {
return ((rgb[0]*255 << 16) + (rgb[1]*255 << 8) + rgb[2]*255);
};
/**
* Checks whether the Canvas BlendModes are supported by the current browser
*
* @method canUseNewCanvasBlendModes
* @return {Boolean} whether they are supported
*/
PIXI.canUseNewCanvasBlendModes = function()
{
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = 1;
var context = canvas.getContext('2d');
context.fillStyle = '#000';
context.fillRect(0,0,1,1);
context.globalCompositeOperation = 'multiply';
context.fillStyle = '#fff';
context.fillRect(0,0,1,1);
return context.getImageData(0,0,1,1).data[0] === 0;
};
/**
* Given a number, this function returns the closest number that is a power of two
* this function is taken from Starling Framework as its pretty neat ;)
*
* @method getNextPowerOfTwo
* @param number {Number}
* @return {Number} the closest number that is a power of two
*/
PIXI.getNextPowerOfTwo = function(number)
{
if (number > 0 && (number & (number - 1)) === 0) // see: http://goo.gl/D9kPj
return number;
else
{
var result = 1;
while (result < number) result <<= 1;
return result;
}
};
/**