Search the Community

Showing results for tags 'arcade physics'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Coding and Game Design
  • Frameworks
    • Phaser
    • Pixi.js
    • Babylon.js
    • Panda.js
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Found 26 results

  1. I have a block based game that requires separated physics bodies, which is why I can't merge a wall of five bodies into one. It appears like the player could still hit the floor in-between the blocks, if the player is forcing itself towards that direction, which makes me think that the bodies are slightly overlapping and causing this. I'm using arcade physics. Is there a way to avoid this? A video here shows the player executing the bug on the top of the tower. He's jumping on the wall, eventually getting over it.
  2. Hey! I have a group of enemies created like this (called from create()): spawnEnemies: function(map){ this.enemies =; this.enemies.enableBody = true;; var enemyStartPositions = this.findObjectsByType('enemyStart',, 'objectLayer'); for(var i = 0; i < enemyStartPositions.length; i++){ var enemyStart = enemyStartPositions[i]; var enemy = new Enemy(, enemyStart.x, enemyStart.y, 'cultist'); enemy.countStats(); this.enemies.add(enemy); } this.enemies.setAll("body.immovable", true); } In the update function - I try to detect the collision between the children in the group like in this example (using 2.4.7): physics&f=group vs self.js&t=group vs self&phaser_version=v2.4.7&; But they wont collide with - just passing trough - each other. Also tried with adding a callback as when I let the player sprite collide with the enemy group like this:, this.enemies, this.collisionHandlerPlayerAndEnemy, null, this);, null, this.collisionHandlerEnemyAndEnemy); And the callback-function will not be called (may it be that this does not even work at all when the case is group to group?). I need someone elses eyes on this. No properties for enemy body is set outside these code blocks.
  3. var mainState = { preload: function() { // This function will be executed at the beginning // That's where we load the game's assets game.load.image('player', 'assets/player.png'); game.load.image('wallV', 'assets/wallVertical.png'); game.load.image('wallH', 'assets/wallHorizontal.png'); game.load.image('player2', 'assets/secondplayer.png'); }, create: function() { game.stage.backgroundColor = '#3498db'; game.physics.startSystem(Phaser.Physics.ARCADE); this.player2 = game.add.sprite(200,100, 'player2'); this.player2.anchor.setTo(0.5, 0.5); game.physics.arcade.enable(this.player2); //first enable gravity this.player2.body.gravity.y = 500; //then use gravity properties. this.player = game.add.sprite(,, 'player'); this.player.anchor.setTo(0.5, 0.5); game.physics.arcade.enable(this.player); this.player.body.gravity.y = 500; this.cursor = game.input.keyboard.createCursorKeys(); // Create a new group this.walls =; // Add Arcade physics to the whole group this.walls.enableBody = true; // Create 2 walls in the group game.add.sprite(0, 0, 'wallV', 0, this.walls); // Left wall game.add.sprite(780, 0, 'wallV', 0, this.walls); // Right wall game.add.sprite(0,580, 'wallH' , 0, this.walls); //horizontal wall. this.walls.setAll('body.immovable', true); // this.createWorld(); }, //timer update: function() { game.physics.arcade.collide(this.player, this.walls); this.movePlayer(); game.physics.arcade.collide(this.player2, this.walls); }, movePlayer: function() { // If the left arrow key is pressed if (this.cursor.left.isDown) { // Move the player to the left this.player.body.velocity.x = -200; } // If the right arrow key is pressed else if (this.cursor.right.isDown) { // Move the player to the right this.player.body.velocity.x = 200; } else if (this.cursor.up.isDown) && (this.player.body.touching.wallH == true) { this.player.body.velocity.y = -500; //this.cursor.up.isDown := false } else if (this.cursor.down.isDown) { this.player.body.velocity.y = 200; } // If neither the right or left arrow key is pressed else { // Stop the player this.player.body.velocity.x = 0; //this.player.body.velocity.y = 0; } // If the up arrow key is pressed and the player is touching the ground if (this.cursor.up.isDown && this.player.body.touching.down) { // Move the player upward (jump) this.player.body.velocity.y = -320; } }, }; var game = new Phaser.Game(800, 600, Phaser.AUTO, 'gameDiv'); game.state.add('main', mainState); game.state.start('main'); Hello! I am very new to Phaser, only started out a few days ago. As you might expect, I will do some dumb mistakes. My issue here is that my character that works, (the one controllable with arrow keys) has the ability to jump to infinity. I have tried a bit of code with a double if condition to solve this, but I can't get the syntax right and I don't know how to check if the player is touching the horizontal wall or not. (I don't want it to jump unless it's touching the horizontal wall, that way I can't keep on jumping in mid air. Here's the horrible bit of code I am attempting to get to work: //if i'm pressing up AND the player is touching the wall THEN set vertical velocity to -500px. else if (this.cursor.up.isDown) && (this.player.body.touching.wallH == true) { this.player.body.velocity.y = -500; } I have attached all my actual code. I'm new here, I don't know how to write this condition, thanks for your help main.js
  4. Hey guys! I'm having another issue with my endless runner and arcade physics bodies. This time bodies seem to flicker for a frame after I have call kill/reset on their sprites. Basically I have three chunks which are laid out and scrolled on screen one other the other. Once a chunk has scrolled off the opposite side of the screen, the layout is reshuffled and it is positioned behind the previous chunks so it can scroll back on screen. Before reshuffling the layout, I forEachAlive -> member.kill(). This is because it's possible that no every child of the chunk will be used in the new layout, so I want to pool them. When I generate the new layout, I reset(x, y) the child. This seems to cause the body of the child to flicker on screen despite the chunk being off screen. I wrote an example and attached it to help demonstrate the issue I am having.
  5. I've been working on a Phaser game for a project at university. All of this is relatively new stuff to me, so I'm learning on the fly. I've managed to create a simple tilemap using Tiled, and got it to import to Phaser successfully. However, I can't make the player collide with the 'platform' layer, and I've tried just about everything I can find online. I've cut down my game code to just what's needed for you to (hopefully) point out my error, but it all runs without errors usually. I can also upload any JSON or Image files that might be needed. var SuddenGame = SuddenGame || {}; var char; var map; // GAMEPLAY STATE // SuddenGame.playState = function() {}; SuddenGame.playState.prototype = { init: function() { = true; }, create: function() { //Setup FPS Counter = true; //Stop game from pausing if a player tabs out this.stage.disableVisibilityChange = true; //Import and play background music music ='menumusic');'', 0, 1, true); //Create Dotted Background this.background =, -'background').height,,'background').height, 'background' ); this.dots =, -'dots').height,,'dots').height, 'dots' ); //Enable Physics Engine; //Add level one tilemap map ='levelone'); map.addTilesetImage('scifi_platformTiles_32x32', 'scifi_platformTiles_32x32'); backgroundTiles = map.createLayer('backgroundLayer'); Objective = map.createLayer('Objective'); Platform = map.createLayer('Platform');; this.physics.arcade.enable(Platform); map.setCollisionBetween(1, 1000, true, 'Platform'); Platform.resizeWorld(); Platform.debug = true; this.char = this.add.sprite(50, 470, 'hero'); this.physics.arcade.enable(this.char); this.char.body.gravity.y = 1300; this.char.body.collideWorldBounds = true; this.char.scale.setTo(2, 2); //Create Player Animations var idle = this.char.animations.add('idle', [0]); var walk = this.char.animations.add('walk', [0, 1, 2, 1]);; }, update: function() {, Platform); this.physics.arcade.TILE_BIAS = 40; if ( && !this.char.body.touching.left) { this.char.body.velocity.x = -150;'backwalk', 10, true); } else if ( && !this.char.body.touching.right) { this.char.body.velocity.x = 150;'walk', 10, true); } else if ( {'die', 10, true); } else { this.char.body.velocity.x = 0;'idle', 7, true); } if ( && > jumpTimer) { {'jump', 10); this.char.body.velocity.y = -1000; jumpTimer = + 750; } } //if (this.cursors.up.isDown && !this.char.body.touching.down ) { if ( && && this.char.body.touching.left && > jumpTimer) { this.char.body.velocity.y = -500; jumpTimer = + 1; } if ( && && this.char.body.touching.right) { this.char.body.velocity.y = -500; this.char.body.velocity.x = -2500; //jumpTimer = + 1; } //More update code here }, render: function() { || '--', 2, 14, "#00ff00"); } } Apologies if I've missed an extremely obvious mistake!
  6. Hi! I want to make a pixel game with a resolution of 144*256 pixels. I want to keep the pixel look also when I rotate a sprite. So the player is able to see tilted pixels. So i decided to set the real dimension of the game to the full available size like 1920*1080. Then I put everything inside a Group and scale the whole Group up so that the game fits the canvas. Also I'm using the Arcade physics and there is where the problem takes place. The physics bodies are not scaled with the group and so the whole szene is useless^^ So is there a solution to scale a whole stage or the "game" up to maximal resolution but working correctly with a design resolution? The Falsh engine Starling worked like this and that was very handy cause you get the real pixel count of the device without taking care of that. Thanks in advance^^
  7. Hey guys! I'm making an endless runner and I'm running into a weird issue with Arcade physics. Because my game is an endless running, I'm anchoring my player on the screen and moving the objects towards the player instead of using the camera. My issue is that I get collision events however none of the body.blocked booleans are being set, so I know a collision happens, but I don't know which side it happens on (up, down, or left). I'm checking for collision like such:, this.chunks[0], levelHandler, null, ctx);, this.chunks[1], levelHandler, null, ctx);, this.chunks[2], levelHandler, null, ctx); Basically, what I'm doing is I spawn three chunks (or segments) of objects and position them one screen length apart from each other. I then scroll each group on screen towards the player. When a chunk is scrolled off the opposite side of the screen, I reposition it back behind the last chunk in the list so it can be scrolled back on towards the player. My 'levelHandler' is being called properly, and it's giving my the object that the player collided with. Again, my issue is the object.body.blocked booleans aren't being set, so I don't know whether the player hit the left side, top, or bottom of the object. Would this be because I'm not moving the objects by applying a velocity to the object's body? I'm moving the parent group of the objects so I don't have to iterate through all my objects to do that. Is there another way to get the information I want? Or am I going to have to write my own detection to get which side was hit after the collision happened?
  8. Hey everyone, I stepped upon an interesting thing or self induced bug that seems to be happening whilst using Arcade Physics for an infinite runner. It's pretty rough around the edges, more of a proof of concept than anything else, but basically in the update function I'm doing a couple of things. First of all, the ground is a group of child sprites, each ones velocity gets nudged left per update cycle: this.ground.children.forEach(function(c) { c.body.velocity.x = -this.RUN_SPEED; }, this); Then, I check to see if any of those children have gone off screen to the left (child.body.right < 0) for example. Once that's done, I then reset that child back to the right hand side of the screen like so: child.reset(, child.y); In between all that I just do a couple of checks to make sure none of them overlap, by using this (it also makes sure we don't try to place anything else whilst this particular piece is still leaving the right-hand area: this.ground.children.find(function(child){ return child.x < && child.x + child.width > || child.x >=; }, this); Now the main problem I'm having is that there seems to be a gap between each one of the sprites when they've been resetted and are following the one that came before hand. What I find interesting is that if I set the velocity to 256, the gap between each sprite seems to be exactly 12 pixels in width. If I drop it to 128, then it drops to 6 pixels in width. I'm curious as to how the numbers might correlate, or, is there something that happens in the physics step that's making the gap outside of the main update loop? It's a bit of a weird problem, and as said earlier, it's probably just down to poor implementation. I've attached the script file if you'd fancy a perusal also. Thanks for your time everyone, take care! IFPlay.js
  9. LATEST UPDATE Hi thanks for looking, but I have figured out my issue since posting this question. Here is a codepen with Box2d Phaser physics moving the bottom sprite with a sprite resting on top , and having the top sprite's physics respond - even after it has been inactive or at rest: --------------------------------- New to Phaser JS and trying to build a "simple" game; If you imagine the game brick breaker - just the base and the ball. I want to be able to move the base up and have the ball still sitting on the base. I also want to be able to tilt the base and have the ball "roll" down depending on which side is tilted. Update 2 Here is a codepen of my Box2d Phaser attempt which comes closest to what I'm trying to achieve. If you use the arrow keys immediately to move the base up,down,left, right (while coliding with the box) then physics work as expected. If you wait a few seconds after the box rests on the base, moving the base has no effect on the box; I would like the box to be effected by the base even after the initial wait: Update 1 Using Phaser's default Arcade Physics, I am now able to get the up movement of the base to keep the ball sitting on-top (although there are some brief overlap's that I'd like to keep from happening and not sure how to prevent that at the moment?); I was not able to allow the ball to "roll" down either side while tilting the base. It seems that even though the base is being rotated that the collision area is not being moved and the ball does not know that it needs to "roll" down. Here is an example phaser sanbox with debugging information (move left or right to see the base rotate):
  10. Hey all! I'm having an issue where i'm trying to reset the player sprite, but it doesn't do anything, and the console yields no errors and i know i'm trying to reset the right thing. I recently grabbed a copy of Phaser 2.5, and yet if i switch back to the older phaser i was using (2.4.4) the reset i have works correctly. I'm a little stumped on what I'm missing here, any help would be appreciated!
  11. Hi, I'm building a little game where a ship is contained within a square in the middle of the game world and "bounces" off the walls. It's easier to just see it in action so here's what I have so far: The ship starts in the middle of the canvas, spinning endlessly. When you click or touch the canvas, the ship moves forward in the angle it's facing. So I have a 640x960 canvas with a red background and then I draw a black 600x600 rounded rectangle in the center, then I add 4 objects on top, bottom and sides that are the "walls" meant to keep the ship within the square. I'm using a group for these walls. Right now the ship bounces off the edges of the game world but as far as I can tell it doesn't collide with the walls at all. Here's my code: var defaults = { canvasWidth: 640, canvasHeight: 960, angle: -90, velocity: 500, angularVelocity: 400, }; var game = new Phaser.Game(defaults.canvasWidth, defaults.canvasHeight, Phaser.AUTO, 'container', { preload: preload, create: create, update: update, render: render }); var walls; var ship; function preload() { game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; game.load.image('wall', 'assets/wall.png'); game.load.image('ship', 'assets/ship.png'); game.load.image('coin', 'assets/coin.png'); game.load.image('bomb', 'assets/bomb.png'); } function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = "#FF0000"; // "#37474F"; var graphics =, 180); graphics.beginFill(0x000000, 1); graphics.drawRoundedRect(0, 0, 600, 600, 8); walls = game.add.physicsGroup(); wall_top = walls.create(0, 0, 'wall'); wall_top.scale.setTo(640, 180); wall_top.body.immovable = true; wall_right = walls.create(620, 180, 'wall'); wall_right.scale.setTo(20, 600); wall_right.body.immovable = true; wall_bottom = walls.create(0, 780, 'wall'); wall_bottom.scale.setTo(640, 180); wall_bottom.body.immovable = true; wall_left = walls.create(0, 180, 'wall'); wall_left.scale.setTo(20, 600); wall_left.body.immovable = true; ship = game.add.sprite(defaults.canvasWidth * 0.5, defaults.canvasHeight * 0.5, 'ship'); ship.scale.setTo(0.5, 0.5); ship.anchor.set(0.5, 0.5); ship.angle = defaults.angle; game.physics.arcade.enable(ship); ship.body.allowGravity = false; ship.body.immovable = true; ship.body.collideWorldBounds = true; ship.body.bounce.setTo(1, 1); ship.body.angularVelocity = defaults.angularVelocity; } function update() { game.physics.arcade.collide(ship, walls); if(game.input.activePointer.isDown) { ship.body.angularVelocity = 0; ship.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(ship.angle, defaults.velocity)); } else { ship.body.angularVelocity = defaults.angularVelocity; ship.body.velocity.set(0, 0); } if(ship.body.blocked.up || ship.body.blocked.down || ship.body.touching.up || ship.body.touching.down) { ship.angle = 0 - ship.angle; ship.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(ship.angle, defaults.velocity)); } if(ship.body.blocked.right || ship.body.blocked.left || ship.body.touching.right || ship.body.touching.left) { ship.angle = 180 - ship.angle; ship.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(ship.angle, defaults.velocity)); } } function render() { // game.debug.spriteInfo(ship, 32, 32); } Any idea what I'm missing? I'm using latest Phaser version 2.4.4 by the way.
  12. Hi, I've set up a group of sprites and they generally collide with each other fine, but if they are overlapping they don't separate (ie force each other apart). Is this only available with other physics types like Box2D or have I missed something? create() { this.enemiesGroup =; this.enemiesGroup.enableBody = true; this.enemiesGroup.physicsBodyType = Phaser.Physics.ARCADE; for(var i=0; i < 20; i++) { var enemy:Phaser.Sprite = this.enemiesGroup.create(game.rnd.integerInRange(100, 770), game.rnd.integerInRange(0, 570), "gameboy", game.rnd.integerInRange(2,5))"enemy"+i; enemy.body.bounce.y=0.8 enemy.body.collideWorldBounds=true; }}update() {, group, this.groupCollisionHandler, null, this);}thanks J
  13. I have this Sprite that has a child Emitter. At certain points, dictated by the AI, the emitter explodes out all the particles. I collide the emitter against my tilemap's collision layer and overlap it against the player. Both the collision layer and the player are exposed as properties on my game instance. When a particle overlaps the player I set alive to false and kill the particle. That works great. The particles also successfully collide against the collision layer. However, they don't bounce. It looks like the tilemap separator code *should* be bouncing them, but it's not. Here's the emitter's creation in my Sprite constructor: var screamEmitter = game.add.emitter(0, 0, 20); screamEmitter.makeParticles('screamParticle'); screamEmitter.setAllChildren('body.allowGravity', false); screamEmitter.setXSpeed(-200, 200); screamEmitter.setYSpeed(-100, 75); screamEmitter.setAlpha(1, 0, 1500, Phaser.Easing.Quadratic.In); screamEmitter.setScale(1, 2, 1, 2, 1500, Phaser.Easing.Cubic.Out); this.addChild(screamEmitter); screamEmitter.x = 0; screamEmitter.y = -10; this.scream = screamEmitter;Here's the collision and overlap calls from my Sprite's update method:,;,, this.onScreamVsPlayerCollision, null, this);Here's how I start the emitter via a timed event off a state machine: this.scream.start(true, 1500, null, 1000);Like I said: the particles come out just fine, they collide with player and collision layer just fine... they just don't bounce. Any ideas?
  14. I'm using arcade.collide to detect collision between a single Sprite and a group of Sprites. The documentation states collide should return true if there was a successful collision. Whether there is a successful collision or not the collide function always returns false for me. I just updated to 2.4.2 to see if that would fix my issue but no luck. Here's basically what my code looks like. if (, groupOfSprites, null, this.collisionProcess, this)) { console.log("Successful collision!"); } The "Successful collision!" log will not be hit even if the collision was successful. Has anyone else experienced this? Is there an alternative way to determine if a collision was successful and have separate code paths for each outcome? Some more information about my setup. Windows 10 Chrome Phaser 2.4.2 TypeScript
  15. Is it possible to adjust the arcade physics collision boxes of tiles in a tilemap? You can change the offset and size of the body for a sprite, but can you do the same with a tile?
  16. If I have a sprite standing on top of two tiles like this: The collision code will always return the one on the left as the collided tile even if most of the hitbox is standing on top of the one on the right. I want to make my character react differently based on what tile it bounces off, but players get confused when the character is bouncing mostly off a tile type A and the reaction corresponds to a tyle type B that it was barely touching.
  17. In my game, I set the mass of the player to 5 and the mass of all other sprites to zero. However, the player still slows down when he hits those sprites. Is this intended? Also, if the player has a mass greater than 20 and collides with a sprite whose mass is 1 weird things happen.
  18. Hi, I'm developing an html5 game using phaser + cocoonjs. So far there is only 1 sprite with velocity set, so basically it just moves from right to left. As simple as it sounds, running this on android device (and sometimes in chrome) I noticed that the sprite doesn't move smoothly, it's laggy! I'm not sure if there is a better way to animate the sprite that makes it smooth. Here is the code I have, I also attached the full application. /// <reference path="js/phaser.min.js" />var w = window.innerWidth;var h = window.innerHeight; var game = new Phaser.Game(w, h, Phaser.AUTO, '', { preload: preload, create: create, update: update });var speed = -250; function preload() { game.load.image('trainHead', 'img/trainHead3.png');} function create() { var globalY = / 3; trainUnitHeight = h / 8; trainUnitWidth = w / 5; // Train head trainHead = game.add.sprite(, globalY, 'trainHead'); trainHead.anchor.setTo(0.5); SetDimensions(trainHead, trainUnitWidth, trainUnitHeight); game.physics.arcade.enable(trainHead); trainHead.body.velocity.x = speed;} function update() {} function SetDimensions(sprite, width, height) { sprite.width = width; sprite.height = height;} Any help/suggestions are greatly appreciated! Thanks!!
  19. Hello, I've used both individual sprites and a group (from a set of arrays). Either way once I enable Arcade physics the sprites dissapear. full code is here : I've used same method elsewhere without issues, so I'm completely stumped. Any help appreciated. ////////////////////////place players//////players_group =;if (typeof players_list != 'undefined') {for (var index = 0; index < players_list.length; index++) {var key = players_list[index].id//add_players[index] = game.add.sprite(players_list[index].posx, players_list[index].posy, key);players_group.create(players_list[index].posx, players_list[index].posy, key);}game.physics.enable( players_group, Phaser.Physics.ARCADE);}
  20. Hello everyone, I've been looking in to how one might create sloping tiles in Phaser.js and its Arcade physics engine. From what I've done so far, I just basically have two squares moving through the middle of an existing square as an experiment to see if my 'limited' knowledge of maths actually works (see fiddle): My plan was to simply move a sprite along that same trajectory while ignoring the left and right collisions of the tile... So I gave it a shot and attempted to apply the method to Phaser, although had very little luck doing so. I've checked out a few articles but sadly don't 100% understand them yet, so heading back to them after posting this. I just wondered if anyone else had any luck, and if you may have some pointers on how to go about it. Cheers for your time guys, -D
  21. This is a severe, game-breaking problem. When the framerate goes below ~50, my character (using arcade-physics) just falls through the tiles. You can incite this on purpose by scaling the browser window rapidly. I'm using Firefox 33.1 on OSX 10.9.4.
  22. Hi, the problem is that body is not move straight if drag property set. Check asteroids example There are some roaming at the end of ship moving. How it can be fixed?
  23. Hey, I am hard at work on my game "Space Cat" and I have some questions about one way collision on tilemaps. Like, is there a way to do this without making the one way colliding tiles into immovable objects (which I assume isn't TERRIBLE, it still uses the quadtree but it has to update more variables). I have a collision tilemap in two layers, one with "ground" and "walls" and one for one way platforms. The problem is how the tilemap body is handled isn't super clear. I was thinking of writing an extension of the collide function to specifically deal with this. Any help would be groovy.
  24. Hi, New to Phaser, but I can't seem to get some basic functionality working. Using Arcade physics, when my sprites hop on top of each other they compress and sometimes fall through the floor. Like so: I've feel like I've tried everything but I wouldn't be surprised if I missed something obvious. Here's what I hope is the relevant code. Please forgive its poor quality. I've also attached the whole file if that helps. Thanks! function create() { // A simple background for our game game.add.sprite(0, 0, 'sky'); // The platforms group contains the ground and the 2 ledges we can jump on platforms =; // We will enable physics for any object that is created in this group platforms.enableBody = true; // Here we create the ground. var ground = platforms.create(0,, 'ground'); // Scale it to fit the width of the game (the original sprite is 400x32 in size) ground.scale.setTo(2, 2); // This stops it from falling away when you jump on it ground.body.immovable = true; ground.body.allowGravity = false; // The player and its settings player = game.add.sprite(150, - 150, 'dude'); player2 = game.add.sprite(300, - 150, 'dude'); player3 = game.add.sprite(450, - 150, 'dude'); player4 = game.add.sprite(600, - 150, 'dude'); players =; players.add(player); players.add(player2); players.add(player3); players.add(player4); // We need to enable physics on the player game.physics.arcade.enable(players, Phaser.Physics.ARCADE); game.physics.arcade.OVERLAP_BIAS = 30; game.physics.arcade.TILE_BIAS = 1000; game.physics.arcade.gravity.y = 2600; players.callAll('body.collideWorldBounds', 'body', true); player.body.bounce.x = 0; player.body.bounce.y = 0; player.body.allowRotation = false; player2.body.bounce.x =0; player2.body.bounce.y =0; player2.body.allowRotation = false; player3.body.bounce.x =0; player3.body.bounce.y =0; player3.body.allowRotation = false; player4.body.bounce.x =0; player4.body.bounce.y =0; player4.body.allowRotation = false; // Our two animations, walking left and right. players.callAll('animations.add', 'animations', 'left', [0, 1, 2, 3], 10, true); players.callAll('animations.add', 'animations', 'right', [5, 6, 7, 8], 10, true); // The score scoreText = game.add.text(200, 300, '', { fontSize: '68px', fill: '#000' }); // Our controls. cursors = game.input.keyboard.createCursorKeys(); // Finally some stars to collect stars =; // We will enable physics for any star that is created in this group stars.enableBody = true;}function update() { // Collide the player and the stars with the platforms game.physics.arcade.collide(platforms, players); game.physics.arcade.collide(players, players); game.physics.arcade.collide(stars, platforms); // Checks to see if the player overlaps with any of the stars, if he does call the collectStar function game.physics.arcade.overlap(players, stars, collectStar, null, this); // Reset the players velocity (movement) player.body.velocity.x = 0; player2.body.velocity.x = 0; player3.body.velocity.x = 0; player4.body.velocity.x = 0; player.body.angle = 0; player2.body.angle = 0; player3.body.angle = 0; player4.body.angle = 0; }index.html
  25. Hi Everyone, I am currently working on my first game using Phaser but I am having an issue with using accelerateToXY. I am developing a space invaders type game and for the bullet code I am following parts of the tanks example to try and fire a bullet. Here is the line it seems to be stuck on: bullet.rotation = game.physics.arcade.accelerateToXY('playerBullet', this.player.x, this.player.y + 10, 40, 100, 100);However when trying to fire the bullet I get the following error message in the console from phaser.min.js: "Uncaught TypeError: Cannot read property 'acceleration' of undefined" If anyone could offer any assistance with this issue it would be greatly appreciated Thanks, Jaymeh Edit: I am currently running phaser version 2.0.6