From ca9321ef424698b4481e84b79218dbcd20a557b2 Mon Sep 17 00:00:00 2001 From: photonstorm Date: Wed, 9 Oct 2013 05:13:38 +0100 Subject: [PATCH] Updated physics body to use localTransform. Updated tanks demo. --- README.md | 2 +- examples/assets/games/tanks/bullet.png | Bin 0 -> 905 bytes examples/buttons/rotated buttons.php | 21 +++----- examples/games/tanks.php | 71 +++++++++++++------------ src/physics/arcade/ArcadePhysics.js | 8 +-- src/physics/arcade/Body.js | 12 ++--- src/utils/Debug.js | 2 - 7 files changed, 53 insertions(+), 63 deletions(-) create mode 100644 examples/assets/games/tanks/bullet.png diff --git a/README.md b/README.md index 6880acc2..7a37845e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Version 1.0.7 (in progress in the dev branch) * Added World.postUpdate - all sprite position changes, as a result of physics, happen here before the render. * Complete overhaul of Physics.Arcade.Body - now significantly more stable and faster too. * Updated ArcadePhysics.separateX/Y to use new body system - much better results now. -* QuadTree bug found in 1.0.5 now fixed. The QuadTree is updated properly now using worldTransform values. +* QuadTree bug found in 1.0.5 now fixed. The QuadTree is updated properly now using localTransform values. * Fixed the Bounce.In and Bounce.InOut tweens (thanks XekeDeath) * Renamed Phaser.Text.text to Phaser.Text.content to avoid conflict and overwrite from Pixi local var. * Renamed Phaser.Text.style to Phaser.Text.font to avoid conflict and overwrite from Pixi local var. diff --git a/examples/assets/games/tanks/bullet.png b/examples/assets/games/tanks/bullet.png new file mode 100644 index 0000000000000000000000000000000000000000..a8e639a0a8a7f910dcfcd74e79339a4830e36294 GIT binary patch literal 905 zcmV;419tq0P)!O_3|3Y!Fkn(PFgUpV1ta|vCY1yP3XUE*xh-S={b}J+}8~z!=QPIyi_o_srMrJr(b=gs7h<6rUwjFBPpt zLVt5tZ?gH{fB^^tNQJZJchBFOoDr#Iw}#^|fWbO>)e5niuG}}gM-`<5IaVFGe+I^K zVFoxC0K`4(bxyNW>~wFCxU<%GEhD@~zLR?xD5V9}^9#DaDb3H~s-%Tx@A_90#fO0T z_@V^^=g0lch-1x>mjKvtND5b_qiq<;Q{yZXiM=sE_1|jR-VxPPsuvRn09j_h>F2PM zi`49Yqt7g-$^`ph#$*9-`4C8KIO@QK#!_-1U;t9hs73(v#f)K1A!yB3i!t}uyLr7Z zl8krBEDI#Y&gTILBssGLR=|RZS79cQbB!^Tm|0KQ2EGxt2n?6-W5G#d$sMAD8c;@-SfIOy5b(nSXOM_tW z9t(a0q-Ktph3`g+mzJ6QM8CHs7bTQgkkVlQTzXAq`a@0`DQzhTUJgBGLS}wsI`$wx zS$I$-XSX}5B8mk14gfM>P%TTcSGMz3uqLtLjCKs{c+5yyvayty6}(#9Pa~nLI0bo_3=&Cxf zk8wqmMa2UsnsF#;={yI(D=?B}E)0T6FTZU5p>enELs4;0^hx)zC!0LZ?WBT)Uny%InPhWzAVqw}p_CG0U1_^Ln zO#!I-yfR}H03m>wHjX~sKRo - - var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create,update : update }); function preload() { @@ -14,41 +12,34 @@ game.load.spritesheet('button', 'assets/buttons/button_sprite_sheet.png', 193, 71); game.load.image('background','assets/misc/starfield.jpg'); - } - var button, - background; + 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, 1, 0, 2); + // 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 + // 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; + button.angle += 1; } - -