diff --git a/build/build.php b/build/build.php index 416fdb51..82f84bdf 100644 --- a/build/build.php +++ b/build/build.php @@ -8,7 +8,7 @@ $buildLog = "Building version $version \n\n"; $header = ""; - $js = file(dirname(__FILE__) . '/../examples/js.php'); + $js = file(dirname(__FILE__) . '/../examples/phaser-debug-js.php'); $output = ""; for ($i = 0; $i < count($js); $i++) diff --git a/build/phaser.js b/build/phaser.js index 0253f68b..96ca286c 100644 --- a/build/phaser.js +++ b/build/phaser.js @@ -9,7 +9,7 @@ * * Phaser - http://www.phaser.io * -* v1.0.7 - Built at: Fri, 18 Oct 2013 01:36:29 +0100 +* v1.0.7 - Built at: Tue, 22 Oct 2013 00:54:52 +0100 * * By Richard Davey http://www.photonstorm.com @photonstorm * diff --git a/examples/animation/animation wraparound.php b/examples/animation/animation wraparound.php deleted file mode 100644 index aef294fe..00000000 --- a/examples/animation/animation wraparound.php +++ /dev/null @@ -1,52 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/animation/change texture on click.js b/examples/animation/change texture on click.js new file mode 100644 index 00000000..5b8487df --- /dev/null +++ b/examples/animation/change texture on click.js @@ -0,0 +1,39 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render }); + +function preload() { + + game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json'); + game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18); + +} + +var bot; + +function create() { + + bot = game.add.sprite(200, 200, 'bot'); + + bot.animations.add('run'); + + bot.animations.play('run', 15, true); + + game.input.onDown.addOnce(changeMummy, this); + +} + +function changeMummy() { + + bot.loadTexture('mummy', 0); + + bot.animations.add('walk'); + + bot.animations.play('walk', 30, true); + +} + +function render() { + + game.debug.renderSpriteBounds(bot); + +} diff --git a/examples/animation/change texture.php b/examples/animation/change texture.php deleted file mode 100644 index 67aa9f0a..00000000 --- a/examples/animation/change texture.php +++ /dev/null @@ -1,51 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/animation/from a JSON object.php b/examples/animation/from a JSON object.php deleted file mode 100644 index c42d0643..00000000 --- a/examples/animation/from a JSON object.php +++ /dev/null @@ -1,144 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/animation/from a texturePacker file.php b/examples/animation/from a texturePacker file.php deleted file mode 100644 index 67420bd1..00000000 --- a/examples/animation/from a texturePacker file.php +++ /dev/null @@ -1,38 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/animation/local json object.js b/examples/animation/local json object.js new file mode 100644 index 00000000..59dbf984 --- /dev/null +++ b/examples/animation/local json object.js @@ -0,0 +1,126 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create}); + +function preload() { + + // Texture Atlas Method 2 + // + // In this example we assume that the TexturePacker JSON data is a real json object stored as a var + // (in this case botData) + + game.load.atlas('bot', 'assets/sprites/running_bot.png', null, botData); + +} + +var bot; + +function create() { + + bot = game.add.sprite(game.world.centerX, 300, 'bot'); + + bot.animations.add('run'); + bot.animations.play('run', 10, true); + +} + +var botData = { + "frames": [ + +{ + "filename": "running bot.swf/0000", + "frame": { "x": 34, "y": 128, "w": 56, "h": 60 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 0, "y": 2, "w": 56, "h": 60 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0001", + "frame": { "x": 54, "y": 0, "w": 56, "h": 58 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0002", + "frame": { "x": 54, "y": 58, "w": 56, "h": 58 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0003", + "frame": { "x": 0, "y": 192, "w": 34, "h": 64 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 11, "y": 0, "w": 34, "h": 64 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0004", + "frame": { "x": 0, "y": 64, "w": 54, "h": 64 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 1, "y": 0, "w": 54, "h": 64 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0005", + "frame": { "x": 196, "y": 0, "w": 56, "h": 58 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0006", + "frame": { "x": 0, "y": 0, "w": 54, "h": 64 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 1, "y": 0, "w": 54, "h": 64 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0007", + "frame": { "x": 140, "y": 0, "w": 56, "h": 58 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0008", + "frame": { "x": 34, "y": 188, "w": 50, "h": 60 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 3, "y": 2, "w": 50, "h": 60 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0009", + "frame": { "x": 0, "y": 128, "w": 34, "h": 64 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 11, "y": 0, "w": 34, "h": 64 }, + "sourceSize": { "w": 56, "h": 64 } +}, +{ + "filename": "running bot.swf/0010", + "frame": { "x": 84, "y": 188, "w": 56, "h": 58 }, + "rotated": false, + "trimmed": true, + "spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 }, + "sourceSize": { "w": 56, "h": 64 } +}], + "meta": { + "app": "http://www.texturepacker.com", + "version": "1.0", + "image": "running_bot.png", + "format": "RGBA8888", + "size": { "w": 252, "h": 256 }, + "scale": "0.2", + "smartupdate": "$TexturePacker:SmartUpdate:fb56f261b1eb04e3215824426595f64c$" + } +}; diff --git a/examples/animation/looped animation.js b/examples/animation/looped animation.js new file mode 100644 index 00000000..24a137d1 --- /dev/null +++ b/examples/animation/looped animation.js @@ -0,0 +1,35 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); + +function preload() { + game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json'); +} + +var bot; + +function create() { + + // This sprite is using a texture atlas for all of its animation data + bot = game.add.sprite(200, 200, 'bot'); + + // Here we add a new animation called 'run' + // We haven't specified any frames because it's using every frame in the texture atlas + bot.animations.add('run'); + + // And this starts the animation playing by using its key ("run") + // 15 is the frame rate (15fps) + // true means it will loop when it finishes + bot.animations.play('run', 15, true); + +} + +function update() { + + bot.x -= 2; + + if (bot.x < -bot.width) + { + bot.x = game.world.width; + } + +} diff --git a/examples/animation/multiple anims.js b/examples/animation/multiple anims.js new file mode 100644 index 00000000..316b91b7 --- /dev/null +++ b/examples/animation/multiple anims.js @@ -0,0 +1,20 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); + +function preload() { + game.load.atlas('bot', 'assets/misc/NumberSprite.png', 'assets/misc/NumberSprite.json'); +} + +function create() { + + var bot = game.add.sprite(200, 200, 'bot'); + + bot.animations.add('num1', ['num10000','num10001','num10002','num10003','num10004','num10005'], 24, false, false); + bot.animations.add('num2', ['num20000','num20001','num20002','num20003','num20004','num20005'], 24, false, false); + bot.animations.add('num3', ['num30000','num30001','num30002','num30003','num30004','num30005'], 24, false, false); + + // bot.animations.play('num1', 15, true); + // bot.animations.play('num2', 15, true); + // bot.animations.play('num3', 15, true); + +} diff --git a/examples/animation/multiple anims.php b/examples/animation/multiple anims.php deleted file mode 100644 index 5189cfe3..00000000 --- a/examples/animation/multiple anims.php +++ /dev/null @@ -1,36 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/animation/sprite sheet.js b/examples/animation/sprite sheet.js new file mode 100644 index 00000000..589b2316 --- /dev/null +++ b/examples/animation/sprite sheet.js @@ -0,0 +1,27 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); + +function preload() { + + // 37x45 is the size of each frame + + // There are 18 frames in the PNG - you can leave this value blank if the frames fill up the entire PNG, but in this case there are some + // blank frames at the end, so we tell the loader how many to load + + game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18); +} + +function create() { + + var mummy = game.add.sprite(300, 200, 'mummy'); + + // Here we add a new animation called 'walk' + // Because we didn't give any other parameters it's going to make an animation from all available frames in the 'mummy' sprite sheet + mummy.animations.add('walk'); + + // And this starts the animation playing by using its key ("walk") + // 30 is the frame rate (30fps) + // true means it will loop when it finishes + mummy.animations.play('walk', 20, true); + +} diff --git a/examples/animation/sprite sheet.php b/examples/animation/sprite sheet.php deleted file mode 100644 index 3e491088..00000000 --- a/examples/animation/sprite sheet.php +++ /dev/null @@ -1,39 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/animation/texture packer json hash.js b/examples/animation/texture packer json hash.js new file mode 100644 index 00000000..64c5e456 --- /dev/null +++ b/examples/animation/texture packer json hash.js @@ -0,0 +1,22 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create }); + +function preload() { + game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json'); +} + +function create() { + + // This sprite is using a texture atlas for all of its animation data + var bot = game.add.sprite(200, 200, 'bot'); + + // Here we add a new animation called 'run' + // We haven't specified any frames because it's using every frame in the texture atlas + bot.animations.add('run'); + + // And this starts the animation playing by using its key ("run") + // 15 is the frame rate (15fps) + // true means it will loop when it finishes + bot.animations.play('run', 15, true); + +} diff --git a/examples/html/fonts/HelveticaNeueLTStd-Bd.otf b/examples/assets/html/HelveticaNeueLTStd-Bd.otf similarity index 100% rename from examples/html/fonts/HelveticaNeueLTStd-Bd.otf rename to examples/assets/html/HelveticaNeueLTStd-Bd.otf diff --git a/examples/html/js/application.js b/examples/assets/html/application.js similarity index 100% rename from examples/html/js/application.js rename to examples/assets/html/application.js diff --git a/examples/assets/html/bg-footer.jpg b/examples/assets/html/bg-footer.jpg new file mode 100644 index 00000000..5189cb55 Binary files /dev/null and b/examples/assets/html/bg-footer.jpg differ diff --git a/examples/html/img/controls-label.png b/examples/assets/html/controls-label.png similarity index 100% rename from examples/html/img/controls-label.png rename to examples/assets/html/controls-label.png diff --git a/examples/html/demo.html b/examples/assets/html/demo.html similarity index 100% rename from examples/html/demo.html rename to examples/assets/html/demo.html diff --git a/examples/html/img/down-label.png b/examples/assets/html/down-label.png similarity index 100% rename from examples/html/img/down-label.png rename to examples/assets/html/down-label.png diff --git a/examples/html/img/flixel-logo.png b/examples/assets/html/flixel-logo.png similarity index 100% rename from examples/html/img/flixel-logo.png rename to examples/assets/html/flixel-logo.png diff --git a/examples/html/img/footer-bg.jpg b/examples/assets/html/footer-bg.jpg similarity index 100% rename from examples/html/img/footer-bg.jpg rename to examples/assets/html/footer-bg.jpg diff --git a/examples/assets/html/footer-bg2.jpg b/examples/assets/html/footer-bg2.jpg new file mode 100644 index 00000000..4811c450 Binary files /dev/null and b/examples/assets/html/footer-bg2.jpg differ diff --git a/examples/html/img/forums-icon.png b/examples/assets/html/forums-icon.png similarity index 100% rename from examples/html/img/forums-icon.png rename to examples/assets/html/forums-icon.png diff --git a/examples/html/img/game-controls-bg.jpg b/examples/assets/html/game-controls-bg.jpg similarity index 100% rename from examples/html/img/game-controls-bg.jpg rename to examples/assets/html/game-controls-bg.jpg diff --git a/examples/html/img/github-icon.png b/examples/assets/html/github-icon.png similarity index 100% rename from examples/html/img/github-icon.png rename to examples/assets/html/github-icon.png diff --git a/examples/html/img/gradient-bg.jpg b/examples/assets/html/gradient-bg.jpg similarity index 100% rename from examples/html/img/gradient-bg.jpg rename to examples/assets/html/gradient-bg.jpg diff --git a/examples/html/img/group-item-hover.png b/examples/assets/html/group-item-hover.png similarity index 100% rename from examples/html/img/group-item-hover.png rename to examples/assets/html/group-item-hover.png diff --git a/examples/html/img/group-item.png b/examples/assets/html/group-item.png similarity index 100% rename from examples/html/img/group-item.png rename to examples/assets/html/group-item.png diff --git a/examples/html/img/header-bg.jpg b/examples/assets/html/header-bg.jpg similarity index 100% rename from examples/html/img/header-bg.jpg rename to examples/assets/html/header-bg.jpg diff --git a/examples/assets/html/header-bg2.jpg b/examples/assets/html/header-bg2.jpg new file mode 100644 index 00000000..5dcabec2 Binary files /dev/null and b/examples/assets/html/header-bg2.jpg differ diff --git a/examples/assets/html/inconsolata.woff b/examples/assets/html/inconsolata.woff new file mode 100644 index 00000000..6170a0bf Binary files /dev/null and b/examples/assets/html/inconsolata.woff differ diff --git a/examples/html/index.html b/examples/assets/html/index.html similarity index 100% rename from examples/html/index.html rename to examples/assets/html/index.html diff --git a/examples/html/img/laser1.png b/examples/assets/html/laser1.png similarity index 100% rename from examples/html/img/laser1.png rename to examples/assets/html/laser1.png diff --git a/examples/html/img/laser10.png b/examples/assets/html/laser10.png similarity index 100% rename from examples/html/img/laser10.png rename to examples/assets/html/laser10.png diff --git a/examples/html/img/laser2.png b/examples/assets/html/laser2.png similarity index 100% rename from examples/html/img/laser2.png rename to examples/assets/html/laser2.png diff --git a/examples/html/img/laser3.png b/examples/assets/html/laser3.png similarity index 100% rename from examples/html/img/laser3.png rename to examples/assets/html/laser3.png diff --git a/examples/html/img/laser4.png b/examples/assets/html/laser4.png similarity index 100% rename from examples/html/img/laser4.png rename to examples/assets/html/laser4.png diff --git a/examples/html/img/laser5.png b/examples/assets/html/laser5.png similarity index 100% rename from examples/html/img/laser5.png rename to examples/assets/html/laser5.png diff --git a/examples/html/img/laser6.png b/examples/assets/html/laser6.png similarity index 100% rename from examples/html/img/laser6.png rename to examples/assets/html/laser6.png diff --git a/examples/html/img/laser7.png b/examples/assets/html/laser7.png similarity index 100% rename from examples/html/img/laser7.png rename to examples/assets/html/laser7.png diff --git a/examples/html/img/laser8.png b/examples/assets/html/laser8.png similarity index 100% rename from examples/html/img/laser8.png rename to examples/assets/html/laser8.png diff --git a/examples/html/img/laser9.png b/examples/assets/html/laser9.png similarity index 100% rename from examples/html/img/laser9.png rename to examples/assets/html/laser9.png diff --git a/examples/html/img/left-label.png b/examples/assets/html/left-label.png similarity index 100% rename from examples/html/img/left-label.png rename to examples/assets/html/left-label.png diff --git a/examples/assets/html/lite_footer.jpg b/examples/assets/html/lite_footer.jpg new file mode 100644 index 00000000..51549193 Binary files /dev/null and b/examples/assets/html/lite_footer.jpg differ diff --git a/examples/assets/html/lite_header.jpg b/examples/assets/html/lite_header.jpg new file mode 100644 index 00000000..0aa2e2fc Binary files /dev/null and b/examples/assets/html/lite_header.jpg differ diff --git a/examples/assets/html/lite_header_2.jpg b/examples/assets/html/lite_header_2.jpg new file mode 100644 index 00000000..fa1eb718 Binary files /dev/null and b/examples/assets/html/lite_header_2.jpg differ diff --git a/examples/html/img/mute-button.png b/examples/assets/html/mute-button.png similarity index 100% rename from examples/html/img/mute-button.png rename to examples/assets/html/mute-button.png diff --git a/examples/html/img/nav-icons.png b/examples/assets/html/nav-icons.png similarity index 100% rename from examples/html/img/nav-icons.png rename to examples/assets/html/nav-icons.png diff --git a/examples/html/img/pause-button.png b/examples/assets/html/pause-button.png similarity index 100% rename from examples/html/img/pause-button.png rename to examples/assets/html/pause-button.png diff --git a/examples/html/img/phaser-examples.png b/examples/assets/html/phaser-examples.png similarity index 100% rename from examples/html/img/phaser-examples.png rename to examples/assets/html/phaser-examples.png diff --git a/examples/html/img/phaser-logo.png b/examples/assets/html/phaser-logo.png similarity index 100% rename from examples/html/img/phaser-logo.png rename to examples/assets/html/phaser-logo.png diff --git a/examples/html/img/phaser-version.png b/examples/assets/html/phaser-version.png similarity index 100% rename from examples/html/img/phaser-version.png rename to examples/assets/html/phaser-version.png diff --git a/examples/html/img/photonstorm-logo.png b/examples/assets/html/photonstorm-logo.png similarity index 100% rename from examples/html/img/photonstorm-logo.png rename to examples/assets/html/photonstorm-logo.png diff --git a/examples/html/img/prize-bg.png b/examples/assets/html/prize-bg.png similarity index 100% rename from examples/html/img/prize-bg.png rename to examples/assets/html/prize-bg.png diff --git a/examples/html/img/prize-button.png b/examples/assets/html/prize-button.png similarity index 100% rename from examples/html/img/prize-button.png rename to examples/assets/html/prize-button.png diff --git a/examples/html/img/reset-button.png b/examples/assets/html/reset-button.png similarity index 100% rename from examples/html/img/reset-button.png rename to examples/assets/html/reset-button.png diff --git a/examples/html/img/right-label.png b/examples/assets/html/right-label.png similarity index 100% rename from examples/html/img/right-label.png rename to examples/assets/html/right-label.png diff --git a/examples/html/img/space-label.png b/examples/assets/html/space-label.png similarity index 100% rename from examples/html/img/space-label.png rename to examples/assets/html/space-label.png diff --git a/examples/html/img/twitter-icon.png b/examples/assets/html/twitter-icon.png similarity index 100% rename from examples/html/img/twitter-icon.png rename to examples/assets/html/twitter-icon.png diff --git a/examples/html/img/up-label.png b/examples/assets/html/up-label.png similarity index 100% rename from examples/html/img/up-label.png rename to examples/assets/html/up-label.png diff --git a/examples/html/img/version-button.png b/examples/assets/html/version-button.png similarity index 100% rename from examples/html/img/version-button.png rename to examples/assets/html/version-button.png diff --git a/examples/assets/skies/cavern1.png b/examples/assets/skies/cavern1.png index 9002fae2..15a4ba97 100644 Binary files a/examples/assets/skies/cavern1.png and b/examples/assets/skies/cavern1.png differ diff --git a/examples/assets/skies/cavern2.png b/examples/assets/skies/cavern2.png index c20943de..9b2ecaf1 100644 Binary files a/examples/assets/skies/cavern2.png and b/examples/assets/skies/cavern2.png differ diff --git a/examples/assets/skies/chrome.png b/examples/assets/skies/chrome.png index 414f578e..3d66c32d 100644 Binary files a/examples/assets/skies/chrome.png and b/examples/assets/skies/chrome.png differ diff --git a/examples/assets/skies/fire.png b/examples/assets/skies/fire.png index 759fac2b..8aeab72a 100644 Binary files a/examples/assets/skies/fire.png and b/examples/assets/skies/fire.png differ diff --git a/examples/assets/skies/fog.png b/examples/assets/skies/fog.png index 76c7386c..3108b97e 100644 Binary files a/examples/assets/skies/fog.png and b/examples/assets/skies/fog.png differ diff --git a/examples/assets/skies/sky1.png b/examples/assets/skies/sky1.png index 18a30759..f439c0ca 100644 Binary files a/examples/assets/skies/sky1.png and b/examples/assets/skies/sky1.png differ diff --git a/examples/assets/skies/sky2.png b/examples/assets/skies/sky2.png index 10a85c76..6dd8f580 100644 Binary files a/examples/assets/skies/sky2.png and b/examples/assets/skies/sky2.png differ diff --git a/examples/assets/skies/sky3.png b/examples/assets/skies/sky3.png index 26714faf..e51fdb32 100644 Binary files a/examples/assets/skies/sky3.png and b/examples/assets/skies/sky3.png differ diff --git a/examples/assets/skies/sky4.png b/examples/assets/skies/sky4.png index a2989c3e..5972639f 100644 Binary files a/examples/assets/skies/sky4.png and b/examples/assets/skies/sky4.png differ diff --git a/examples/assets/skies/sky5.png b/examples/assets/skies/sky5.png index 58db4343..70538fe7 100644 Binary files a/examples/assets/skies/sky5.png and b/examples/assets/skies/sky5.png differ diff --git a/examples/assets/skies/space1.png b/examples/assets/skies/space1.png index 9d7643f1..9ad3ec1f 100644 Binary files a/examples/assets/skies/space1.png and b/examples/assets/skies/space1.png differ diff --git a/examples/assets/skies/space2.png b/examples/assets/skies/space2.png index 2198cd4d..a203627a 100644 Binary files a/examples/assets/skies/space2.png and b/examples/assets/skies/space2.png differ diff --git a/examples/assets/skies/sunorbit.png b/examples/assets/skies/sunorbit.png index 8ccc1305..11920576 100644 Binary files a/examples/assets/skies/sunorbit.png and b/examples/assets/skies/sunorbit.png differ diff --git a/examples/assets/skies/sunset.png b/examples/assets/skies/sunset.png index 18f5212b..5ccb7eff 100644 Binary files a/examples/assets/skies/sunset.png and b/examples/assets/skies/sunset.png differ diff --git a/examples/assets/skies/toxic.png b/examples/assets/skies/toxic.png index 8bfb378d..0bba6f5f 100644 Binary files a/examples/assets/skies/toxic.png and b/examples/assets/skies/toxic.png differ diff --git a/examples/assets/skies/underwater1.png b/examples/assets/skies/underwater1.png index c1ee9900..94bbf376 100644 Binary files a/examples/assets/skies/underwater1.png and b/examples/assets/skies/underwater1.png differ diff --git a/examples/assets/skies/underwater2.png b/examples/assets/skies/underwater2.png index 0af1808a..b02373cc 100644 Binary files a/examples/assets/skies/underwater2.png and b/examples/assets/skies/underwater2.png differ diff --git a/examples/assets/skies/underwater3.png b/examples/assets/skies/underwater3.png index d4ff8955..e5197df3 100644 Binary files a/examples/assets/skies/underwater3.png and b/examples/assets/skies/underwater3.png differ diff --git a/examples/assets/skies/wtf.png b/examples/assets/skies/wtf.png index 35159e26..d8559095 100644 Binary files a/examples/assets/skies/wtf.png and b/examples/assets/skies/wtf.png differ diff --git a/examples/audio/loop.js b/examples/audio/loop.js new file mode 100644 index 00000000..18360077 --- /dev/null +++ b/examples/audio/loop.js @@ -0,0 +1,28 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create}); + +function preload() { + + game.load.image('spyro', 'assets/pics/spyro.png'); + + // Firefox doesn't support mp3 files, so use ogg + game.load.audio('squit', ['assets/audio/SoundEffects/squit.mp3', 'assets/audio/SoundEffects/squit.ogg']); + +} + +var s; +var music; + +function create() { + + game.stage.backgroundColor = '#255d3b'; + + + music = game.add.audio('squit',1,true); + + music.play('',0,1,true); + + s = game.add.sprite(game.world.centerX, game.world.centerY, 'spyro'); + s.anchor.setTo(0.5, 0.5); + +} diff --git a/examples/audio/loop.php b/examples/audio/loop.php deleted file mode 100644 index ceda86ee..00000000 --- a/examples/audio/loop.php +++ /dev/null @@ -1,46 +0,0 @@ - - - - - diff --git a/examples/audio/play music.js b/examples/audio/play music.js new file mode 100644 index 00000000..2f471f82 --- /dev/null +++ b/examples/audio/play music.js @@ -0,0 +1,51 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('disk', 'assets/sprites/ra_dont_crack_under_pressure.png'); + + // Firefox doesn't support mp3 files, so use ogg + game.load.audio('boden', ['assets/audio/bodenstaendig_2000_in_rock_4bit.mp3', 'assets/audio/bodenstaendig_2000_in_rock_4bit.ogg']); + +} + +var s; +var music; + +function create() { + + game.stage.backgroundColor = '#182d3b'; + game.input.touch.preventDefault = false; + + music = game.add.audio('boden'); + music.play(); + + s = game.add.sprite(game.world.centerX, game.world.centerY, 'disk'); + s.anchor.setTo(0.5, 0.5); + + game.input.onDown.add(changeVolume, this); + +} + +function changeVolume(pointer) { + + if (pointer.y < 300) + { + music.volume += 0.1; + } + else + { + music.volume -= 0.1; + } + +} + +function update() { + s.rotation += 0.01; +} + +function render() { + game.debug.renderSoundInfo(music, 20, 32); +} + diff --git a/examples/audio/play music.php b/examples/audio/play music.php deleted file mode 100644 index fb851adb..00000000 --- a/examples/audio/play music.php +++ /dev/null @@ -1,66 +0,0 @@ - - - - - diff --git a/examples/build.php b/examples/build.php new file mode 100644 index 00000000..262d7eff --- /dev/null +++ b/examples/build.php @@ -0,0 +1,37 @@ + + +
+ + + + + + + + \ No newline at end of file diff --git a/examples/buttons/action on click.js b/examples/buttons/action on click.js new file mode 100644 index 00000000..d9746835 --- /dev/null +++ b/examples/buttons/action on click.js @@ -0,0 +1,28 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); + +function preload() { + + game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71); + game.load.image('background','assets/misc/starfield.jpg'); + +} + +var button; +var background; + +function create() { + + game.stage.backgroundColor = '#182d3b'; + + background = game.add.tileSprite(0, 0, 800, 600, 'background'); + + button = game.add.button(game.world.centerX - 95, 400, 'button', actionOnClick, this, 2, 1, 0); + +} + +function actionOnClick () { + + background.visible =! background.visible; + +} diff --git a/examples/buttons/action on click.php b/examples/buttons/action on click.php deleted file mode 100644 index dc1cbbb2..00000000 --- a/examples/buttons/action on click.php +++ /dev/null @@ -1,48 +0,0 @@ - - - - - diff --git a/examples/buttons/changing the frames.js b/examples/buttons/changing the frames.js new file mode 100644 index 00000000..8d2d3777 --- /dev/null +++ b/examples/buttons/changing the frames.js @@ -0,0 +1,32 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create }); + +function preload() { + + game.load.spritesheet('button', 'assets/buttons/number-buttons-90x90.png', 90,90); + game.load.image('background','assets/misc/starfield.jpg'); + +} + +var button; +var background; + +function create() { + + // Setting the background colour + game.stage.backgroundColor = '#182d3b'; + + // The numbers given in parameters are the indexes of the frames, in this order: over, out, down + button = game.add.button(game.world.centerX, game.world.centerY, 'button', actionOnClick, this, 1, 0, 2); + + // setting the anchor to the center + button.anchor.setTo(0.5, 0.5); + +} + +function actionOnClick () { + + // Manually changing the frames of the button, i.e, how it will look when you play with it + button.setFrames(4, 3, 5); + +} diff --git a/examples/buttons/changing the frames.php b/examples/buttons/changing the frames.php deleted file mode 100644 index 9367f6fe..00000000 --- a/examples/buttons/changing the frames.php +++ /dev/null @@ -1,55 +0,0 @@ - - - - - diff --git a/examples/buttons/rotated buttons.js b/examples/buttons/rotated buttons.js new file mode 100644 index 00000000..ecd842a7 --- /dev/null +++ b/examples/buttons/rotated buttons.js @@ -0,0 +1,36 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create,update : update }); + +function preload() { + + game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71); + game.load.image('background','assets/misc/starfield.jpg'); + +} + +var button; +var background; + +function create() { + + game.stage.backgroundColor = '#cccccc'; + + // The numbers given in parameters are the indexes of the frames, in this order: over, out, down + button = game.add.button(game.world.centerX, game.world.centerY, 'button', actionOnClick, this, 2, 1, 0); + + // Set the anchor of the sprite in the center, otherwise it would rotate around the top-left corner + button.anchor.setTo(0.5, 0.5); + +} + +function actionOnClick () { + + alert("Though I'm turning around, you can still click on me"); + +} + +function update () { + + button.angle += 1; + +} diff --git a/examples/buttons/rotated buttons.php b/examples/buttons/rotated buttons.php deleted file mode 100644 index 10ebf1ed..00000000 --- a/examples/buttons/rotated buttons.php +++ /dev/null @@ -1,47 +0,0 @@ - - - - - diff --git a/examples/camera/basic follow.js b/examples/camera/basic follow.js new file mode 100644 index 00000000..9a225a92 --- /dev/null +++ b/examples/camera/basic follow.js @@ -0,0 +1,60 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +var baddie; +var keys = Phaser.Keyboard; + +function preload() { + + game.load.image('background','assets/misc/starfield.jpg'); + game.load.image('ufo','assets/sprites/ufo.png'); + game.load.image('baddie','assets/sprites/space-baddie.png'); + +} + +function create() { + + game.add.tileSprite(0, 0, 2000, 2000, 'background'); + + game.world.setBounds(0, 0, 1400,1400); + + for (var i = 0; i < 10; i++) + { + game.add.sprite(game.world.randomX, game.world.randomY, 'ufo'); + } + + baddie = game.add.sprite(150, 320, 'baddie'); + + game.camera.follow(baddie); + +} + +function update() { + + baddie.body.velocity.setTo(0, 0); + + if (game.input.keyboard.isDown(keys.LEFT) && !game.input.keyboard.isDown(keys.RIGHT)) + { + baddie.body.velocity.x = -155; + } + else if (game.input.keyboard.isDown(keys.RIGHT) && !game.input.keyboard.isDown(keys.LEFT)) + { + baddie.body.velocity.x = 155; + } + else if (game.input.keyboard.isDown(keys.UP) && !game.input.keyboard.isDown(keys.DOWN)) + { + baddie.angle = 90; + baddie.body.velocity.y = -155; + } + else if (game.input.keyboard.isDown(keys.DOWN) && !game.input.keyboard.isDown(keys.UP)) + { + baddie.angle = 90; + baddie.body.velocity.y = 155; + } +} + +function render() { + + game.debug.renderCameraInfo(game.camera, 32, 32); + +} diff --git a/examples/camera/basic follow.php b/examples/camera/basic follow.php deleted file mode 100644 index 501494ab..00000000 --- a/examples/camera/basic follow.php +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - diff --git a/examples/camera/camera cull.js b/examples/camera/camera cull.js new file mode 100644 index 00000000..6060ada2 --- /dev/null +++ b/examples/camera/camera cull.js @@ -0,0 +1,48 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + game.load.image('disk', 'assets/sprites/ra_dont_crack_under_pressure.png'); +} + +var s; + +function create() { + + game.stage.backgroundColor = '#182d3b'; + + s = game.add.sprite(game.world.centerX, game.world.centerY, 'disk'); + s.anchor.setTo(0.5, 0.5); + +} + +function update() { + + s.rotation += 0.01; + + if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) + { + s.x -= 4; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) + { + s.x += 4; + } + + if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) + { + s.y -= 4; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) + { + s.y += 4; + } + +} + +function render() { + + game.debug.renderSpriteCorners(s, true, true); + game.debug.renderSpriteInfo(s, 20, 32); + +} diff --git a/examples/camera/camera cull.php b/examples/camera/camera cull.php deleted file mode 100644 index 32196a6a..00000000 --- a/examples/camera/camera cull.php +++ /dev/null @@ -1,64 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/camera/follow styles.js b/examples/camera/follow styles.js new file mode 100644 index 00000000..339dc1e0 --- /dev/null +++ b/examples/camera/follow styles.js @@ -0,0 +1,109 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +var ufo; +var Keys = Phaser.Keyboard; +var speed = 4; +var style = 'default'; + +function preload() { + + 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.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.image('ufo','assets/sprites/ufo.png'); + game.load.image('baddie','assets/sprites/space-baddie.png'); + game.load.spritesheet('button', 'assets/buttons/follow-style-button.png', 224, 70); + +} + +function create() { + + // Make the world larger than the actual canvas + game.world.setBounds(0, 0, 1400, 1400); + + for (var i=0; i < 10; i++) + { + game.add.sprite(game.world.randomX, game.world.randomY, 'baddie'); + } + + // Background images + game.add.tileSprite(0, 0, 1400, 600, 'sky'); + game.add.sprite(0, 360, 'ground'); + game.add.sprite(0, 400, 'river'); + game.add.sprite(200, 120, 'cloud0'); + game.add.sprite(-60, 120, 'cloud1'); + game.add.sprite(900, 170, 'cloud2'); + + // ufo sprite + ufo = game.add.sprite(300, 240, 'ufo'); + + //registration point + ufo.anchor.setTo(0.5, 0.5); + + game.camera.follow(ufo); + + // follow style switch buttons + btn0 = game.add.button(6, 40, 'button', lockonFollow,this, 0, 0, 0); + btn1 = game.add.button(6, 120, 'button', platformerFollow,this, 1, 1, 1); + btn2 = game.add.button(6, 200, 'button', topdownFollow,this, 2, 2, 2); + btn3 = game.add.button(6, 280, 'button', topdownTightFollow,this, 3, 3, 3); + +} + +function lockonFollow() { + game.camera.follow(ufo, Phaser.Camera.FOLLOW_LOCKON); + style = 'STYLE_LOCKON'; +} + +function platformerFollow() { + game.camera.follow(ufo, Phaser.Camera.FOLLOW_PLATFORMER); + style = 'STYLE_PLATFORMER'; +} + +function topdownFollow() { + game.camera.follow(ufo, Phaser.Camera.FOLLOW_TOPDOWN); + style = 'STYLE_TOPDOWN'; +} + +function topdownTightFollow() { + game.camera.follow(ufo, Phaser.Camera.FOLLOW_TOPDOWN_TIGHT); + style = 'STYLE_TOPDOWN_TIGHT'; +} + +function update() { + + if (game.input.keyboard.isDown(Keys.LEFT)) + { + ufo.x -= speed; + ufo.angle = -15; + } + else if (game.input.keyboard.isDown(Keys.RIGHT)) + { + ufo.x += speed; + ufo.angle = 15; + } + else if (game.input.keyboard.isDown(Keys.UP)) + { + ufo.y -= speed; + } + else if (game.input.keyboard.isDown(Keys.DOWN)) + { + ufo.y += speed; + } + else + { + ufo.angle = 0; + } + +} + +function render () { + + game.debug.renderText('Click buttons to switch follow styles', 32, 32); + game.debug.renderText('Current style: ' + style, 32, 64); + +} diff --git a/examples/camera/follow styles.php b/examples/camera/follow styles.php deleted file mode 100644 index 148eec18..00000000 --- a/examples/camera/follow styles.php +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - diff --git a/examples/camera/moving the camera.js b/examples/camera/moving the camera.js new file mode 100644 index 00000000..7bbf28ba --- /dev/null +++ b/examples/camera/moving the camera.js @@ -0,0 +1,52 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); + +function preload() { + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); +} + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + // Make our game world 2000x2000 pixels in size (the default is to match the game size) + game.world.setBounds(0,0,2000, 2000); + + for (var i = 0; i < 50; i++) + { + var s = game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom'); + } + + for (var i = 0; i < 50; i++) + { + game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom'); + } + + for (var i = 0; i < 50; i++) + { + var s = game.add.sprite(game.world.randomX, game.world.randomY, 'mushroom'); + } + +} + +function update() { + + if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) + { + game.camera.x -= 4; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) + { + game.camera.x += 4; + } + + if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) + { + game.camera.y -= 4; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) + { + game.camera.y += 4; + } + +} diff --git a/examples/camera/moving the camera.php b/examples/camera/moving the camera.php deleted file mode 100644 index 3b6e93c5..00000000 --- a/examples/camera/moving the camera.php +++ /dev/null @@ -1,68 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/camera/world sprite.js b/examples/camera/world sprite.js new file mode 100644 index 00000000..13936f22 --- /dev/null +++ b/examples/camera/world sprite.js @@ -0,0 +1,54 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update,render : render }); + +function preload() { + + game.world.setBounds(0, 0, 1920, 1200); + + game.load.image('backdrop', 'assets/pics/remember-me.jpg'); + game.load.image('card', 'assets/sprites/mana_card.png'); + +} + +var card; +var Keys = Phaser.Keyboard; + +function create() { + + game.add.sprite(0, 0, 'backdrop'); + + card = game.add.sprite(200, 200, 'card'); + + card.body.velocity.x = 50; + card.scale.setTo(2, 2); + +} + +function update() { + + if (game.input.keyboard.isDown(Keys.LEFT)) + { + card.x -= 4; + } + else if (game.input.keyboard.isDown(Keys.RIGHT)) + { + card.x += 4; + } + + if (game.input.keyboard.isDown(Keys.UP)) + { + card.y -= 4; + } + else if (game.input.keyboard.isDown(Keys.DOWN)) + { + card.y += 4; + } + +} + +function render() { + + game.debug.renderCameraInfo(game.camera, 32, 32); + game.debug.renderSpriteInfo(card, 32, 200); + +} diff --git a/examples/camera/world sprite.php b/examples/camera/world sprite.php deleted file mode 100644 index 9a0dca40..00000000 --- a/examples/camera/world sprite.php +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - diff --git a/examples/collision/bounding box.js b/examples/collision/bounding box.js new file mode 100644 index 00000000..760e6ce0 --- /dev/null +++ b/examples/collision/bounding box.js @@ -0,0 +1,55 @@ +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + +} + +var sprite1; +var sprite2; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + sprite1 = game.add.sprite(50, 200, 'atari'); + sprite1.name = 'atari'; + sprite1.body.velocity.x = 100; + + // This adjusts the collision body size. + // 100x100 is the new width/height. + // See the offset bounding box for another example. + sprite1.body.setSize(100, 100, 0, 0); + + sprite2 = game.add.sprite(700, 220, 'mushroom'); + sprite2.name = 'mushroom'; + sprite2.body.velocity.x = -100; + +} + +function update() { + + // object1, object2, collideCallback, processCallback, callbackContext + game.physics.collide(sprite1, sprite2, collisionHandler, null, this); + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} + +function render() { + + game.debug.renderSpriteInfo(sprite1, 32, 32); + game.debug.renderSpriteCollision(sprite1, 32, 400); + + game.debug.renderSpriteBody(sprite1); + game.debug.renderSpriteBody(sprite2); + +} diff --git a/examples/collision/bounding box.php b/examples/collision/bounding box.php deleted file mode 100644 index 9dc6eb82..00000000 --- a/examples/collision/bounding box.php +++ /dev/null @@ -1,71 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/group vs group.js b/examples/collision/group vs group.js new file mode 100644 index 00000000..75754867 --- /dev/null +++ b/examples/collision/group vs group.js @@ -0,0 +1,98 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); + +function preload() { + + game.load.image('phaser', 'assets/sprites/phaser-dude.png'); + game.load.image('bullet', 'assets/misc/bullet0.png'); + game.load.spritesheet('veggies', 'assets/sprites/fruitnveg32wh37.png', 32, 32); + +} + +var sprite; +var bullets; +var veggies; +var bulletTime = 0; + +var bullet; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + // This will check Group vs. Group collision (bullets vs. veggies!) + + veggies = game.add.group(); + + for (var i = 0; i < 50; i++) + { + var c = veggies.create(game.world.randomX, Math.random() * 500, 'veggies', game.rnd.integerInRange(0, 36)); + c.name = 'veg' + i; + c.body.immovable = true; + } + + bullets = game.add.group(); + + for (var i = 0; i < 10; i++) + { + var b = bullets.create(0, 0, 'bullet'); + b.name = 'bullet' + i; + b.exists = false; + b.visible = false; + b.events.onOutOfBounds.add(resetBullet, this); + } + + sprite = game.add.sprite(400, 550, 'phaser'); + +} + +function update() { + + sprite.body.velocity.x = 0; + sprite.body.velocity.y = 0; + + if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) + { + sprite.body.velocity.x = -200; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) + { + sprite.body.velocity.x = 200; + } + + if (game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)) + { + fireBullet(); + } + + game.physics.collide(bullets, veggies, collisionHandler, null, this); + +} + +function fireBullet () { + + if (game.time.now > bulletTime) + { + bullet = bullets.getFirstExists(false); + + if (bullet) + { + bullet.reset(sprite.x + 6, sprite.y - 8); + bullet.body.velocity.y = -300; + bulletTime = game.time.now + 250; + } + } + +} + +// Called if the bullet goes out of the screen +function resetBullet (bullet) { + bullet.kill(); +} + +function collisionHandler (bullet, veg) { + + bullet.kill(); + veg.kill(); + +} diff --git a/examples/collision/group vs group.php b/examples/collision/group vs group.php deleted file mode 100644 index d8a03298..00000000 --- a/examples/collision/group vs group.php +++ /dev/null @@ -1,114 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/larger bounding box.js b/examples/collision/larger bounding box.js new file mode 100644 index 00000000..3bde58aa --- /dev/null +++ b/examples/collision/larger bounding box.js @@ -0,0 +1,51 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + +} + +var sprite1; +var sprite2; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + sprite1 = game.add.sprite(50, 200, 'atari'); + sprite1.name = 'atari'; + sprite1.body.velocity.x = 100; + + // In this example the new collision box is much larger than the original sprite + sprite1.body.setSize(400, 50, -100, 20); + + sprite2 = game.add.sprite(700, 220, 'mushroom'); + sprite2.name = 'mushroom'; + sprite2.body.velocity.x = -100; + +} + +function update() { + + // object1, object2, collideCallback, processCallback, callbackContext + game.physics.collide(sprite1, sprite2, collisionHandler, null, this); + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} + +function render() { + + game.debug.renderRectangle(sprite1.body); + game.debug.renderRectangle(sprite2.body); + +} diff --git a/examples/collision/larger bounding box.php b/examples/collision/larger bounding box.php deleted file mode 100644 index 0c61384d..00000000 --- a/examples/collision/larger bounding box.php +++ /dev/null @@ -1,66 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/offset bounding box.js b/examples/collision/offset bounding box.js new file mode 100644 index 00000000..4ae4b1d7 --- /dev/null +++ b/examples/collision/offset bounding box.js @@ -0,0 +1,54 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + +} + +var sprite1; +var sprite2; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + sprite1 = game.add.sprite(50, 200, 'atari'); + sprite1.name = 'atari'; + sprite1.body.velocity.x = 100; + + // This adjusts the collision body size. + // 100x50 is the new width/height. + // 50, 25 is the X and Y offset of the newly sized box. + // In this case the box is 50px in and 25px down. + sprite1.body.setSize(100, 50, 50, 25); + + sprite2 = game.add.sprite(700, 220, 'mushroom'); + sprite2.name = 'mushroom'; + sprite2.body.velocity.x = -100; + +} + +function update() { + + // object1, object2, collideCallback, processCallback, callbackContext + game.physics.collide(sprite1, sprite2, collisionHandler, null, this); + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} + +function render() { + + game.debug.renderRectangle(sprite1.body); + game.debug.renderRectangle(sprite2.body); + +} diff --git a/examples/collision/offset bounding box.php b/examples/collision/offset bounding box.php deleted file mode 100644 index 87a98e85..00000000 --- a/examples/collision/offset bounding box.php +++ /dev/null @@ -1,69 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/sprite tiles.js b/examples/collision/sprite tiles.js new file mode 100644 index 00000000..f2fd2d34 --- /dev/null +++ b/examples/collision/sprite tiles.js @@ -0,0 +1,69 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.spritesheet('tiles', 'assets/tiles/platformer_tiles.png', 16, 16); + game.load.image('carrot', 'assets/sprites/carrot.png'); + +} + +var tiles; +var sprite; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + tiles = game.add.group(); + + for (var x = 0; x < 40; x++) + { + var tile = tiles.create(100 + (x * 16), 300, 'tiles', 4); + tile.body.immovable = true; + } + + sprite = game.add.sprite(300, 150, 'carrot'); + sprite.name = 'mushroom'; + sprite.body.collideWorldBounds = true; + sprite.body.velocity.x = 40; + sprite.body.velocity.y = 120; + sprite.body.bounce.setTo(1, 1); + + game.input.onDown.add(carryOn, this); + +} + +function carryOn() { + + game.paused = false; + +} + +function update() { + + // object1, object2, collideCallback, processCallback, callbackContext + game.physics.collide(sprite, tiles, collisionHandler, null, this); + +} + +function collisionHandler (s, t) { + + t.alpha = 0.5; + + console.log('---------------------------------------------'); + console.log(t.body); + + game.paused = true; + +} + +function render() { + + // game.debug.renderSpriteInfo(sprite1, 32, 32); + // game.debug.renderSpriteCollision(sprite1, 32, 400); + + game.debug.renderSpriteBody(sprite); + // game.debug.renderSpriteBody(sprite2); + +} diff --git a/examples/collision/sprite tiles.php b/examples/collision/sprite tiles.php deleted file mode 100644 index fc39a409..00000000 --- a/examples/collision/sprite tiles.php +++ /dev/null @@ -1,84 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/sprite vs group.js b/examples/collision/sprite vs group.js new file mode 100644 index 00000000..781e10fd --- /dev/null +++ b/examples/collision/sprite vs group.js @@ -0,0 +1,87 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('phaser', 'assets/sprites/phaser-dude.png'); + game.load.spritesheet('veggies', 'assets/sprites/fruitnveg32wh37.png', 32, 32); + +} + +var sprite; +var group; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + // This will check Sprite vs. Group collision + + sprite = game.add.sprite(32, 200, 'phaser'); + sprite.name = 'phaser-dude'; + + group = game.add.group(); + + for (var i = 0; i < 50; i++) + { + var c = group.create(100 + Math.random() * 700, game.world.randomY, 'veggies', game.rnd.integerInRange(0, 36)); + c.name = 'veg' + i; + c.body.immovable = true; + } + + for (var i = 0; i < 20; i++) + { + // Here we'll create some chillis which the player can pick-up. They are still part of the same Group. + var c = group.create(100 + Math.random() * 700, game.world.randomY, 'veggies', 17); + c.name = 'chilli' + i; + c.body.immovable = true; + } + +} + +function update() { + + sprite.body.velocity.x = 0; + sprite.body.velocity.y = 0; + + if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) + { + sprite.body.velocity.x = -200; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) + { + sprite.body.velocity.x = 200; + } + + if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) + { + sprite.body.velocity.y = -200; + } + else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) + { + sprite.body.velocity.y = 200; + } + + game.physics.collide(sprite, group, collisionHandler, null, this); + +} + +function collisionHandler (obj1, obj2) { + + // If the player collides with the chillis then they get eaten :) + // The chilli frame ID is 17 + + console.log('Hit', obj2.name); + + if (obj2.frame == 17) + { + obj2.kill(); + } + +} + +function render () { + + game.debug.renderQuadTree(game.physics.quadTree); + +} diff --git a/examples/collision/sprite vs group.php b/examples/collision/sprite vs group.php deleted file mode 100644 index a8153b41..00000000 --- a/examples/collision/sprite vs group.php +++ /dev/null @@ -1,103 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/sprite vs sprite custom.js b/examples/collision/sprite vs sprite custom.js new file mode 100644 index 00000000..a05f225c --- /dev/null +++ b/examples/collision/sprite vs sprite custom.js @@ -0,0 +1,78 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + +} + +var sprite1; +var sprite2; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + // This will check Sprite vs. Sprite collision using a custom process callback + + sprite1 = game.add.sprite(0, 200, 'atari'); + sprite1.name = 'atari'; + // We'll use a random velocity here so we can test it in our processHandler + sprite1.body.velocity.x = 50 + Math.random() * 100; + // This tells phaser to not use the built-in body separation, instead you should handle it in your process callback (see below) + sprite1.body.customSeparateX = true; + + sprite2 = game.add.sprite(750, 220, 'mushroom'); + sprite2.name = 'mushroom'; + // We'll use a random velocity here so we can test it in our processHandler + sprite2.body.velocity.x = -(50 + Math.random() * 100); + // This tells phaser to not use the built-in body separation, instead you should handle it in your process callback (see below) + sprite2.body.customSeparateX = true; + +} + +function update() { + + game.physics.collide(sprite1, sprite2, collisionHandler, processHandler, this); + +} + +function processHandler (obj1, obj2) { + + // This function can perform your own additional checks on the 2 objects that collided. + // For example you could test for velocity, health, etc. + // If you want the collision to be deemed successful this function must return true. + // In which case the collisionHandler will be called, otherwise it won't. + + // Note: the objects will have already been separated by this point unless you have set + // their customSeparateX/Y flags to true. If you do that it's up to you to handle separation. + + // Whichever one is going fastest wins, the other dies :) + if (obj1.body.velocity.x > Math.abs(obj2.body.velocity.x)) + { + obj2.kill(); + obj1.body.velocity.x = 0; + } + else + { + obj1.kill(); + obj2.body.velocity.x = 0; + } + + return true; + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} + +function render() { +} + diff --git a/examples/collision/sprite vs sprite custom.php b/examples/collision/sprite vs sprite custom.php deleted file mode 100644 index bbf5c44f..00000000 --- a/examples/collision/sprite vs sprite custom.php +++ /dev/null @@ -1,92 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/sprite vs sprite.js b/examples/collision/sprite vs sprite.js new file mode 100644 index 00000000..b344e94e --- /dev/null +++ b/examples/collision/sprite vs sprite.js @@ -0,0 +1,43 @@ + +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + +} + +var sprite1; +var sprite2; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + // This will check Sprite vs. Sprite collision + + sprite1 = game.add.sprite(50, 200, 'atari'); + sprite1.name = 'atari'; + sprite1.body.velocity.x = 100; + + sprite2 = game.add.sprite(700, 220, 'mushroom'); + sprite2.name = 'mushroom'; + sprite2.body.velocity.x = -100; + +} + +function update() { + + // object1, object2, collideCallback, processCallback, callbackContext + game.physics.collide(sprite1, sprite2, collisionHandler, null, this); + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} diff --git a/examples/collision/sprite vs sprite.php b/examples/collision/sprite vs sprite.php deleted file mode 100644 index 02f289a7..00000000 --- a/examples/collision/sprite vs sprite.php +++ /dev/null @@ -1,61 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/transform.js b/examples/collision/transform.js new file mode 100644 index 00000000..4188d132 --- /dev/null +++ b/examples/collision/transform.js @@ -0,0 +1,117 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + game.load.image('flectrum', 'assets/sprites/flectrum.png'); + +} + +var testGroup; +var sprite1; +var sprite2; +var sprite3; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + game.world.setBounds(-1000, -1000, 2000, 2000); + + testGroup = game.add.group(); + + test2(); + +} + +function test1 () { + + // Test 1 - 2 sprites in world space (seems to work fine with local transform?) + sprite1 = game.add.sprite(-600, 200, 'atari'); + sprite1.name = 'atari'; + // sprite1.body.setSize(100, 100, 0, 0); + + sprite2 = game.add.sprite(-100, 220, 'mushroom'); + sprite2.name = 'mushroom'; + + game.camera.focusOn(sprite1); + game.camera.x += 300; + + game.input.onDown.add(go1, this); + +} + +function test2 () { + + // 1 sprite in world space (seems to work fine with local transform?) and 1 in a group + + sprite1 = testGroup.create(0, -150, 'atari'); + sprite1.name = 'atari'; + sprite1.body.immovable = true; + // sprite1.body.setSize(100, 100, 0, 0); + + sprite2 = game.add.sprite(-100, 150, 'mushroom'); + sprite2.name = 'mushroom'; + + sprite3 = game.add.sprite(-200, 150, 'flectrum'); + sprite3.name = 'tall'; + + testGroup.x = -600; + testGroup.y = 200; + + game.camera.focusOn(sprite2); + game.camera.x -= 300; + + game.input.onDown.add(go2, this); + +} + +function go1 () { + + sprite1.body.velocity.x = 100; + sprite2.body.velocity.x = -100; + +} + +function go2 () { + + sprite2.body.velocity.x = -100; + +} + +function update () { + + game.physics.collide(sprite1, sprite2, collisionHandler, null, this); + + // sprite3.angle += 0.5; + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} + +function render() { + + // game.debug.renderSpriteInfo(sprite1, 32, 32); + // game.debug.renderSpriteCollision(sprite1, 32, 400); + + game.debug.renderSpriteCoords(sprite1, 32, 32); + game.debug.renderSpriteCoords(sprite2, 300, 32); + + game.debug.renderCameraInfo(game.camera, 32, 500); + + game.debug.renderSpriteBody(sprite1); + game.debug.renderSpriteBody(sprite2); + game.debug.renderSpriteBody(sprite3); + + game.debug.renderGroupInfo(testGroup, 500, 500); + game.debug.renderPixel(testGroup.x, testGroup.y, 'rgb(255,255,0)'); + +} diff --git a/examples/collision/transform.php b/examples/collision/transform.php deleted file mode 100644 index b33b677c..00000000 --- a/examples/collision/transform.php +++ /dev/null @@ -1,131 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/collision/vertical collision.js b/examples/collision/vertical collision.js new file mode 100644 index 00000000..1d3279ab --- /dev/null +++ b/examples/collision/vertical collision.js @@ -0,0 +1,58 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari', 'assets/sprites/atari130xe.png'); + game.load.image('mushroom', 'assets/sprites/mushroom2.png'); + +} + +var sprite1; +var sprite2; + +function create() { + + game.stage.backgroundColor = '#2d2d2d'; + + sprite1 = game.add.sprite(300, 50, 'atari'); + sprite1.name = 'atari'; + sprite1.body.velocity.y = 100; + + // This adjusts the collision body size. + // 100x100 is the new width/height. + // See the offset bounding box for another example. + sprite1.body.setSize(220, 50, 0, 0); + + sprite2 = game.add.sprite(400, 500, 'mushroom'); + sprite2.name = 'mushroom'; + sprite2.body.immovable = true; + // sprite2.body.velocity.x = -100; + +} + +function update() { + + // object1, object2, collideCallback, processCallback, callbackContext + game.physics.collide(sprite1, sprite2, collisionHandler, null, this); + +} + +function collisionHandler (obj1, obj2) { + + game.stage.backgroundColor = '#992d2d'; + + console.log(obj1.name + ' collided with ' + obj2.name); + +} + +function render() { + + game.debug.renderSpriteInfo(sprite1, 32, 32); + game.debug.renderSpriteCollision(sprite1, 32, 400); + + game.debug.renderSpriteBody(sprite1); + game.debug.renderSpriteBody(sprite2); + +} + diff --git a/examples/collision/vertical collision.php b/examples/collision/vertical collision.php deleted file mode 100644 index 7f0681aa..00000000 --- a/examples/collision/vertical collision.php +++ /dev/null @@ -1,72 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/display/fullscreen.js b/examples/display/fullscreen.js new file mode 100644 index 00000000..5f38a7fa --- /dev/null +++ b/examples/display/fullscreen.js @@ -0,0 +1,40 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); + +function preload() { + + game.load.image('atari1', 'assets/sprites/atari130xe.png'); + +} + +function create() { + + var sprite = game.add.sprite(0, 0, 'atari1'); + + game.stage.backgroundColor = '#e3ed49'; + + game.input.onDown.add(gofull, this); + +} + +function gofull() { + + game.stage.scale.startFullScreen(); + +} + +function update() { + + if (document.getElementsByTagName('body')[0].scrollTop > 1000) + { + game.stage.backgroundColor = '#87ff55'; + window.scrollTo(0, 0); + } + +} + +function render () { + + game.debug.renderText('Tap to go fullscreen', 32, 150); + +} diff --git a/examples/display/fullscreen.php b/examples/display/fullscreen.php deleted file mode 100644 index 29f593dd..00000000 --- a/examples/display/fullscreen.php +++ /dev/null @@ -1,55 +0,0 @@ - - - - - \ No newline at end of file diff --git a/examples/display/graphics.js b/examples/display/graphics.js new file mode 100644 index 00000000..0332560f --- /dev/null +++ b/examples/display/graphics.js @@ -0,0 +1,47 @@ +var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { create: create }); + +function create() { + + var graphics = game.add.graphics(0, 0); + + // set a fill and line style + graphics.beginFill(0xFF3300); + graphics.lineStyle(10, 0xffd900, 1); + + // draw a shape + graphics.moveTo(0,50); + graphics.lineTo(250, 50); + graphics.lineTo(100, 100); + graphics.lineTo(250, 220); + graphics.lineTo(50, 220); + graphics.lineTo(0, 50); + graphics.endFill(); + + // set a fill and line style again + graphics.lineStyle(10, 0xFF0000, 0.8); + graphics.beginFill(0xFF700B, 1); + + // draw a second shape + graphics.moveTo(210,300); + graphics.lineTo(450,320); + graphics.lineTo(570,350); + graphics.lineTo(580,20); + graphics.lineTo(330,120); + graphics.lineTo(410,200); + graphics.lineTo(210,300); + graphics.endFill(); + + // draw a rectangle + graphics.lineStyle(2, 0x0000FF, 1); + graphics.drawRect(50, 250, 100, 100); + + // draw a circle + graphics.lineStyle(0); + graphics.beginFill(0xFFFF0B, 0.5); + graphics.drawCircle(470, 200,100); + + graphics.lineStyle(20, 0x33FF00); + graphics.moveTo(30,30); + graphics.lineTo(600, 300); + +} diff --git a/examples/display/graphics.php b/examples/display/graphics.php deleted file mode 100644 index 530fa88d..00000000 --- a/examples/display/graphics.php +++ /dev/null @@ -1,65 +0,0 @@ - - - - - diff --git a/examples/display/linkedList.php b/examples/display/linkedList.php deleted file mode 100644 index 61b18360..00000000 --- a/examples/display/linkedList.php +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - diff --git a/examples/display/render crisp.js b/examples/display/render crisp.js new file mode 100644 index 00000000..16f56fc0 --- /dev/null +++ b/examples/display/render crisp.js @@ -0,0 +1,32 @@ + +var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create }); + +function preload() { + + game.load.image('boss', 'assets/misc/boss1.png'); + game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71); + +} + +var boss; +var button; + +function create() { + + // For browsers that support it, this keeps our pixel art looking crisp + // This only works when you use Phaser.CANVAS as the renderer + Phaser.Canvas.setSmoothingEnabled(game.context, false); + + boss = game.add.sprite(game.world.centerX, game.world.centerY, 'boss'); + boss.anchor.setTo(0.5, 0.5); + + // Zoom in each time we press the button + button = game.add.button(32, 32, 'button', clickedIt, this, 2, 1, 0); +} + +function clickedIt() { + + boss.scale.x += 0.5; + boss.scale.y += 0.5; + +} diff --git a/examples/display/render crisp.php b/examples/display/render crisp.php deleted file mode 100644 index 9f46bc32..00000000 --- a/examples/display/render crisp.php +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - diff --git a/examples/examples.json b/examples/examples.json new file mode 100644 index 00000000..d9f0e44b --- /dev/null +++ b/examples/examples.json @@ -0,0 +1,188 @@ +{ +"animation": [ + { "file": "change+texture+on+click.js", "title": "change texture on click" }, + { "file": "local+json+object.js", "title": "local json object" }, + { "file": "looped+animation.js", "title": "looped animation" }, + { "file": "multiple+anims.js", "title": "multiple anims" }, + { "file": "sprite+sheet.js", "title": "sprite sheet" }, + { "file": "texture+packer+json+hash.js", "title": "texture packer json hash" } +], +"audio": [ + { "file": "loop.js", "title": "loop" }, + { "file": "play+music.js", "title": "play music" } +], +"buttons": [ + { "file": "action+on+click.js", "title": "action on click" }, + { "file": "changing+the+frames.js", "title": "changing the frames" }, + { "file": "rotated+buttons.js", "title": "rotated buttons" } +], +"camera": [ + { "file": "basic+follow.js", "title": "basic follow" }, + { "file": "camera+cull.js", "title": "camera cull" }, + { "file": "follow+styles.js", "title": "follow styles" }, + { "file": "moving+the+camera.js", "title": "moving the camera" }, + { "file": "world+sprite.js", "title": "world sprite" } +], +"collision": [ + { "file": "bounding+box.js", "title": "bounding box" }, + { "file": "group+vs+group.js", "title": "group vs group" }, + { "file": "larger+bounding+box.js", "title": "larger bounding box" }, + { "file": "offset+bounding+box.js", "title": "offset bounding box" }, + { "file": "sprite+tiles.js", "title": "sprite tiles" }, + { "file": "sprite+vs+group.js", "title": "sprite vs group" }, + { "file": "sprite+vs+sprite+custom.js", "title": "sprite vs sprite custom" }, + { "file": "sprite+vs+sprite.js", "title": "sprite vs sprite" }, + { "file": "transform.js", "title": "transform" }, + { "file": "vertical+collision.js", "title": "vertical collision" } +], +"display": [ + { "file": "fullscreen.js", "title": "fullscreen" }, + { "file": "graphics.js", "title": "graphics" }, + { "file": "render+crisp.js", "title": "render crisp" } +], +"games": [ + { "file": "breakout.js", "title": "breakout" }, + { "file": "invaders.js", "title": "invaders" }, + { "file": "starstruck.js", "title": "starstruck" }, + { "file": "tanks.js", "title": "tanks" } +], +"geometry": [ + { "file": "circle.js", "title": "circle" }, + { "file": "line.js", "title": "line" }, + { "file": "playing+with+points.js", "title": "playing with points" }, + { "file": "rectangle.js", "title": "rectangle" }, + { "file": "rotate+point.js", "title": "rotate point" } +], +"groups": [ + { "file": "add+a+sprite+to+group.js", "title": "add a sprite to group" }, + { "file": "bring+a+child+to+top.js", "title": "bring a child to top" }, + { "file": "bring+a+group+to+top.js", "title": "bring a group to top" }, + { "file": "call+all.js", "title": "call all" }, + { "file": "create+group.js", "title": "create group" }, + { "file": "create+sprite+in+a+group.js", "title": "create sprite in a group" }, + { "file": "display+order.js", "title": "display order" }, + { "file": "for+each.js", "title": "for each" }, + { "file": "get+first.js", "title": "get first" }, + { "file": "group+as+layer.js", "title": "group as layer" }, + { "file": "group+transform+-+rotate.js", "title": "group transform - rotate" }, + { "file": "group+transform+-+tween.js", "title": "group transform - tween" }, + { "file": "group+transform.js", "title": "group transform" }, + { "file": "recyling.js", "title": "recyling" }, + { "file": "remove.js", "title": "remove" }, + { "file": "replace.js", "title": "replace" }, + { "file": "set+All.js", "title": "set All" }, + { "file": "sub+groups+-+group+length.js", "title": "sub groups - group length" }, + { "file": "swap+children+in+a+group.js", "title": "swap children in a group" } +], +"input": [ + { "file": "cursor+key+movement.js", "title": "cursor key movement" }, + { "file": "drag+several+sprites.js", "title": "drag several sprites" }, + { "file": "drag.js", "title": "drag" }, + { "file": "drop+limitation.js", "title": "drop limitation" }, + { "file": "follow+mouse.js", "title": "follow mouse" }, + { "file": "game+scale.js", "title": "game scale" }, + { "file": "key.js", "title": "key" }, + { "file": "keyboard+hotkeys.js", "title": "keyboard hotkeys" }, + { "file": "keyboard+justpressed.js", "title": "keyboard justpressed" }, + { "file": "keyboard.js", "title": "keyboard" }, + { "file": "motion+lock+-+horizontal.js", "title": "motion lock - horizontal" }, + { "file": "motion+lock+-+vertical.js", "title": "motion lock - vertical" }, + { "file": "multi+touch.js", "title": "multi touch" }, + { "file": "override+default+controls.js", "title": "override default controls" }, + { "file": "pixel+perfect+click+detection.js", "title": "pixel perfect click detection" }, + { "file": "pixelpick+-+scrolling+effect.js", "title": "pixelpick - scrolling effect" }, + { "file": "pixelpick+-+spritesheet.js", "title": "pixelpick - spritesheet" }, + { "file": "snap+on+drag.js", "title": "snap on drag" } +], +"loader": [ + { "file": "pick+images+from+cache.js", "title": "pick images from cache" } +], +"misc": [ + { "file": "net.js", "title": "net" }, + { "file": "random+generators.js", "title": "random generators" }, + { "file": "repeatable+random+numbers.js", "title": "repeatable random numbers" } +], +"particles": [ + { "file": "click+burst.js", "title": "click burst" }, + { "file": "collision.js", "title": "collision" }, + { "file": "diamond+burst.js", "title": "diamond burst" }, + { "file": "no+rotation.js", "title": "no rotation" }, + { "file": "random+sprite.js", "title": "random sprite" }, + { "file": "when+particles+collide.js", "title": "when particles collide" }, + { "file": "zero+gravity.js", "title": "zero gravity" } +], +"physics": [ + { "file": "accelerate+to+pointer.js", "title": "accelerate to pointer" }, + { "file": "angle+between.js", "title": "angle between" }, + { "file": "angle+to+pointer.js", "title": "angle to pointer" }, + { "file": "angular+acceleration.js", "title": "angular acceleration" }, + { "file": "angular+velocity.js", "title": "angular velocity" }, + { "file": "mass+velocity+test.js", "title": "mass velocity test" }, + { "file": "move+towards+object.js", "title": "move towards object" }, + { "file": "multi+angle+to+pointer.js", "title": "multi angle to pointer" }, + { "file": "quadtree+-+collision+infos.js", "title": "quadtree - collision infos" }, + { "file": "quadtree+-+ids.js", "title": "quadtree - ids" }, + { "file": "shoot+the+pointer.js", "title": "shoot the pointer" }, + { "file": "sprite+bounds.js", "title": "sprite bounds" } +], +"sprites": [ + { "file": "add+a+sprite.js", "title": "add a sprite" }, + { "file": "add+several+sprites.js", "title": "add several sprites" }, + { "file": "collide+world+bounds.js", "title": "collide world bounds" }, + { "file": "destroy.js", "title": "destroy" }, + { "file": "dynamic+crop.js", "title": "dynamic crop" }, + { "file": "extending+sprite+object+demo+2.js", "title": "extending sprite object demo 2" }, + { "file": "extending+sprite+object.js", "title": "extending sprite object" }, + { "file": "horizontal+crop.js", "title": "horizontal crop" }, + { "file": "move+a+sprite.js", "title": "move a sprite" }, + { "file": "out+of+bounds.js", "title": "out of bounds" }, + { "file": "scale+a+sprite.js", "title": "scale a sprite" }, + { "file": "shared+sprite+textures.js", "title": "shared sprite textures" }, + { "file": "sprite+rotation.js", "title": "sprite rotation" }, + { "file": "spritesheet.js", "title": "spritesheet" }, + { "file": "vertical+crop.js", "title": "vertical crop" } +], +"text": [ + { "file": "bitmap+fonts.js", "title": "bitmap fonts" }, + { "file": "hello+arial.js", "title": "hello arial" }, + { "file": "kern+of+duty.js", "title": "kern of duty" }, + { "file": "remove+text.js", "title": "remove text" }, + { "file": "text+stroke.js", "title": "text stroke" } +], +"tile sprites": [ + { "file": "animated+tiling+sprite.js", "title": "animated tiling sprite" }, + { "file": "tiling+sprite.js", "title": "tiling sprite" } +], +"tilemaps": [ + { "file": "Sci-Fly.js", "title": "Sci-Fly" }, + { "file": "fill+tiles.js", "title": "fill tiles" }, + { "file": "mapcollide.js", "title": "mapcollide" }, + { "file": "mario.js", "title": "mario" }, + { "file": "mariotogether.js", "title": "mariotogether" }, + { "file": "paint+tiles.js", "title": "paint tiles" }, + { "file": "randomise+tiles.js", "title": "randomise tiles" }, + { "file": "replace+tiles.js", "title": "replace tiles" }, + { "file": "supermario.js", "title": "supermario" }, + { "file": "supermario2.js", "title": "supermario2" }, + { "file": "swap+tiles.js", "title": "swap tiles" }, + { "file": "wip1.js", "title": "wip1" }, + { "file": "wip2.js", "title": "wip2" }, + { "file": "wip3.js", "title": "wip3" }, + { "file": "wip4.js", "title": "wip4" } +], +"tweens": [ + { "file": "bounce.js", "title": "bounce" }, + { "file": "bubbles.js", "title": "bubbles" }, + { "file": "chained+tweens.js", "title": "chained tweens" }, + { "file": "combined+tweens.js", "title": "combined tweens" }, + { "file": "easing+spritesheets.js", "title": "easing spritesheets" }, + { "file": "easing.js", "title": "easing" }, + { "file": "fading+in+a+sprite.js", "title": "fading in a sprite" }, + { "file": "pause+tween.js", "title": "pause tween" }, + { "file": "tween+several+properties.js", "title": "tween several properties" } +], +"world": [ + { "file": "fixed+to+camera.js", "title": "fixed to camera" }, + { "file": "move+around+world.js", "title": "move around world" } +] +} \ No newline at end of file diff --git a/examples/foot.php b/examples/foot.php deleted file mode 100644 index 576f8502..00000000 --- a/examples/foot.php +++ /dev/null @@ -1,14 +0,0 @@ - - - -