From 969fa46484064c3470dcee9931e0b19f560c58cf Mon Sep 17 00:00:00 2001 From: Webeled Date: Mon, 14 Oct 2013 19:32:07 +0100 Subject: [PATCH] Loads of new examples, some more bug fixes, all of them work beautifully --- examples/animation/multiple anims.php | 4 +- examples/camera/follow styles.php | 2 +- examples/camera/world sprite.php | 2 +- examples/collision/group vs group.php | 10 +-- examples/collision/sprite vs group.php | 12 ++-- examples/display/graphics.php | 2 - examples/games/invaders.php | 10 +-- examples/geometry/circle.php | 32 +++++++++ examples/geometry/line.php | 32 +++++++++ examples/geometry/playing with points.php | 70 +++++++++++++++++++ examples/geometry/rectangle.php | 30 ++++++++ examples/geometry/rotate point.php | 47 +++++++++++++ examples/groups/group as layer.php | 2 +- examples/input/game scale.php | 2 +- examples/input/keyboard.php | 4 +- .../override browser keyboard controls.php | 2 +- ...p => pixelpick - scrolling background.php} | 6 +- ...lpick2.php => pixelpick - spritesheet.php} | 8 +-- examples/input/pixelpick.php | 2 +- examples/loader/preloadSprite.php | 45 ++++++++++++ examples/quadtree/quadtree.php | 2 +- examples/sprites/collide world bounds.php | 40 +++++++++++ examples/sprites/destroy.php | 39 +++++++++++ examples/sprites/scale a sprite.php | 33 +++++++++ 24 files changed, 400 insertions(+), 38 deletions(-) create mode 100644 examples/geometry/circle.php create mode 100644 examples/geometry/line.php create mode 100644 examples/geometry/playing with points.php create mode 100644 examples/geometry/rectangle.php create mode 100644 examples/geometry/rotate point.php rename examples/input/{pixelpick3.php => pixelpick - scrolling background.php} (93%) rename examples/input/{pixelpick2.php => pixelpick - spritesheet.php} (88%) create mode 100644 examples/loader/preloadSprite.php create mode 100644 examples/sprites/collide world bounds.php create mode 100644 examples/sprites/destroy.php create mode 100644 examples/sprites/scale a sprite.php diff --git a/examples/animation/multiple anims.php b/examples/animation/multiple anims.php index 2ae09ac4c..5189cfe39 100644 --- a/examples/animation/multiple anims.php +++ b/examples/animation/multiple anims.php @@ -7,7 +7,7 @@ - var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create }); + var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create }); function preload() { game.load.atlas('bot', 'assets/misc/NumberSprite.png', 'assets/misc/NumberSprite.json'); @@ -22,7 +22,7 @@ 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('num2', 15, true); // bot.animations.play('num3', 15, true); } diff --git a/examples/camera/follow styles.php b/examples/camera/follow styles.php index 5ff575878..148eec18d 100644 --- a/examples/camera/follow styles.php +++ b/examples/camera/follow styles.php @@ -46,7 +46,7 @@ // background images - game.add.sprite(0, 0, 'sky'); + 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'); diff --git a/examples/camera/world sprite.php b/examples/camera/world sprite.php index ca22cb9cc..9a0dca40f 100644 --- a/examples/camera/world sprite.php +++ b/examples/camera/world sprite.php @@ -12,7 +12,7 @@ function preload() { - game.world.setBounds(1920, 1200); + 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'); diff --git a/examples/collision/group vs group.php b/examples/collision/group vs group.php index 195a5642c..d8a032989 100644 --- a/examples/collision/group vs group.php +++ b/examples/collision/group vs group.php @@ -56,16 +56,16 @@ function update() { - sprite.velocity.x = 0; - sprite.velocity.y = 0; + sprite.body.velocity.x = 0; + sprite.body.velocity.y = 0; if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { - sprite.velocity.x = -200; + sprite.body.velocity.x = -200; } else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { - sprite.velocity.x = 200; + sprite.body.velocity.x = 200; } if (game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)) @@ -86,7 +86,7 @@ if (bullet) { bullet.reset(sprite.x + 6, sprite.y - 8); - bullet.velocity.y = -300; + bullet.body.velocity.y = -300; bulletTime = game.time.now + 250; } } diff --git a/examples/collision/sprite vs group.php b/examples/collision/sprite vs group.php index a5c70261b..a8153b41d 100644 --- a/examples/collision/sprite vs group.php +++ b/examples/collision/sprite vs group.php @@ -49,25 +49,25 @@ function update() { - sprite.velocity.x = 0; - sprite.velocity.y = 0; + sprite.body.velocity.x = 0; + sprite.body.velocity.y = 0; if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { - sprite.velocity.x = -200; + sprite.body.velocity.x = -200; } else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { - sprite.velocity.x = 200; + sprite.body.velocity.x = 200; } if (game.input.keyboard.isDown(Phaser.Keyboard.UP)) { - sprite.velocity.y = -200; + sprite.body.velocity.y = -200; } else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN)) { - sprite.velocity.y = 200; + sprite.body.velocity.y = 200; } game.physics.collide(sprite, group, collisionHandler, null, this); diff --git a/examples/display/graphics.php b/examples/display/graphics.php index 2a1021486..530fa88d2 100644 --- a/examples/display/graphics.php +++ b/examples/display/graphics.php @@ -55,8 +55,6 @@ graphics.moveTo(30,30); graphics.lineTo(600, 300); - game.add.tween(graphics).to({ x: 200 }, 2000, Phaser.Easing.Linear.None, true, 0, 1000, true); - } diff --git a/examples/games/invaders.php b/examples/games/invaders.php index f2d59ff6a..05e671d22 100644 --- a/examples/games/invaders.php +++ b/examples/games/invaders.php @@ -65,16 +65,16 @@ function update() { - player.velocity.x = 0; - player.velocity.y = 0; + player.body.velocity.x = 0; + player.body.velocity.y = 0; if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT)) { - player.velocity.x = -200; + player.body.velocity.x = -200; } else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT)) { - player.velocity.x = 200; + player.body.velocity.x = 200; } if (game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)) @@ -95,7 +95,7 @@ if (bullet) { bullet.reset(player.x, player.y - 8); - bullet.velocity.y = -300; + bullet.body.velocity.y = -300; bulletTime = game.time.now + 250; } } diff --git a/examples/geometry/circle.php b/examples/geometry/circle.php new file mode 100644 index 000000000..3672d01fa --- /dev/null +++ b/examples/geometry/circle.php @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/examples/geometry/line.php b/examples/geometry/line.php new file mode 100644 index 000000000..edfd6474a --- /dev/null +++ b/examples/geometry/line.php @@ -0,0 +1,32 @@ + + + + + \ No newline at end of file diff --git a/examples/geometry/playing with points.php b/examples/geometry/playing with points.php new file mode 100644 index 000000000..c1e008c7b --- /dev/null +++ b/examples/geometry/playing with points.php @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/examples/geometry/rectangle.php b/examples/geometry/rectangle.php new file mode 100644 index 000000000..c1d9211c9 --- /dev/null +++ b/examples/geometry/rectangle.php @@ -0,0 +1,30 @@ + + + + + \ No newline at end of file diff --git a/examples/geometry/rotate point.php b/examples/geometry/rotate point.php new file mode 100644 index 000000000..25905f267 --- /dev/null +++ b/examples/geometry/rotate point.php @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file diff --git a/examples/groups/group as layer.php b/examples/groups/group as layer.php index 5ee9e4f0e..ac433a8d7 100644 --- a/examples/groups/group as layer.php +++ b/examples/groups/group as layer.php @@ -11,7 +11,7 @@ var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create,render:render}); function preload() { - game.world.setBounds(1280, 800); + game.world.setBounds(0,0,1280, 800); game.load.image('ground', 'assets/tests/ground-2x.png'); game.load.image('river', 'assets/tests/river-2x.png'); diff --git a/examples/input/game scale.php b/examples/input/game scale.php index 7aa95b3ab..c977bd65f 100644 --- a/examples/input/game scale.php +++ b/examples/input/game scale.php @@ -27,7 +27,7 @@ function create() { //We increase the size of our game world - game.world.setBounds(2000, 2000); + game.world.setBounds(0,0,2000, 2000); for (var i = 0; i < 1000; i++) { diff --git a/examples/input/keyboard.php b/examples/input/keyboard.php index 423a71e69..26078b137 100644 --- a/examples/input/keyboard.php +++ b/examples/input/keyboard.php @@ -15,7 +15,7 @@ var speed=4; function preload() { - game.world.setBounds(1280, 600); + game.world.setBounds(0,0,1280, 600); 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'); @@ -31,7 +31,7 @@ } function create() { // background images - game.add.sprite(0, 0, 'sky'); + game.add.tileSprite(0, 0,1280,600, 'sky'); game.add.sprite(0, 360, 'ground'); game.add.sprite(0, 400, 'river'); game.add.sprite(200, 120, 'cloud0'); diff --git a/examples/input/override browser keyboard controls.php b/examples/input/override browser keyboard controls.php index ed3825317..71eed94b1 100644 --- a/examples/input/override browser keyboard controls.php +++ b/examples/input/override browser keyboard controls.php @@ -15,7 +15,7 @@ var speed=4; function preload() { - game.world.setBounds(1280, 600); + game.world.setBounds(0,0,1280, 600); 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'); diff --git a/examples/input/pixelpick3.php b/examples/input/pixelpick - scrolling background.php similarity index 93% rename from examples/input/pixelpick3.php rename to examples/input/pixelpick - scrolling background.php index e94736376..e8d6495b2 100644 --- a/examples/input/pixelpick3.php +++ b/examples/input/pixelpick - scrolling background.php @@ -1,5 +1,5 @@ @@ -23,10 +23,10 @@ function create() { // Make our world big ... - game.world.setBounds(4000, 2000); + game.world.setBounds(0,0,4000, 2000); // Scrolling background - s = game.add.tileSprite(0, 0, 800, 600, 'stars'); + s = game.add.tileSprite(0, 0, 4000, 600, 'stars'); b = game.add.sprite(200, 200, 'mummy'); b.anchor.setTo(0.5, 0.5); diff --git a/examples/input/pixelpick2.php b/examples/input/pixelpick - spritesheet.php similarity index 88% rename from examples/input/pixelpick2.php rename to examples/input/pixelpick - spritesheet.php index 8cb964289..4eaad2b65 100644 --- a/examples/input/pixelpick2.php +++ b/examples/input/pixelpick - spritesheet.php @@ -1,5 +1,5 @@ @@ -7,7 +7,7 @@ - var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render }); + var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, render: render }); function preload() { @@ -47,10 +47,6 @@ console.log('out'); } - function update() { - // b.angle += 0.1; - } - function render() { game.debug.renderSpriteInputInfo(b, 32, 32); diff --git a/examples/input/pixelpick.php b/examples/input/pixelpick.php index 83917d716..8c4e9fb0f 100644 --- a/examples/input/pixelpick.php +++ b/examples/input/pixelpick.php @@ -1,5 +1,5 @@ diff --git a/examples/loader/preloadSprite.php b/examples/loader/preloadSprite.php new file mode 100644 index 000000000..0b22a34e2 --- /dev/null +++ b/examples/loader/preloadSprite.php @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file diff --git a/examples/quadtree/quadtree.php b/examples/quadtree/quadtree.php index 2cd20d154..ddb3c76f2 100644 --- a/examples/quadtree/quadtree.php +++ b/examples/quadtree/quadtree.php @@ -20,7 +20,7 @@ function create() { - game.world.setBounds(2000, 2000); + game.world.setBounds(0,0,2000, 2000); aliens = []; diff --git a/examples/sprites/collide world bounds.php b/examples/sprites/collide world bounds.php new file mode 100644 index 000000000..35dbf284f --- /dev/null +++ b/examples/sprites/collide world bounds.php @@ -0,0 +1,40 @@ + + + + + \ No newline at end of file diff --git a/examples/sprites/destroy.php b/examples/sprites/destroy.php new file mode 100644 index 000000000..2a611f917 --- /dev/null +++ b/examples/sprites/destroy.php @@ -0,0 +1,39 @@ + + + + + \ No newline at end of file diff --git a/examples/sprites/scale a sprite.php b/examples/sprites/scale a sprite.php new file mode 100644 index 000000000..ccfa88529 --- /dev/null +++ b/examples/sprites/scale a sprite.php @@ -0,0 +1,33 @@ + + + + + \ No newline at end of file