RichJ

Members
  • Content count

    6
  • Joined

  • Last visited

  1. Camera size

    I'm just getting familiar with the camera object and have it following my player around a Tiled map, which was nice 'n easy. A question though. The documentation mentions camera width and height properties, but my camera is always the same size as the stage. Does version 2.7.3 support limiting the camera viewport size, or is this a future thing?
  2. Physics glitch

    Thanks @samme , I tried reading the "touching" properties but that didn't work either. The debug info showed the touching properties being set every other frame.
  3. Physics glitch

    Thanks for the detailed post @drhayes, I've looked into Tilemaps and got it all up and running perfectly. I was yet to come across Tilemaps, still only a few days into Phaser, so I'd fallen into the trap of going against the framework by trying to build up my tile map manually. Can't believe how simple it is to implement a map exported as JSON from the Tiled map editor Shame about the physics bug, but I understand what you're saying. I wrote a very simple 2D physics engine a few months ago for a Monogame project and ran into pretty much the same problem. Thanks again
  4. Physics glitch

    Thanks for the tip, I didn't realise you could display all that debug info. It doesn't show anything up though. Really odd how the problem only occurs when brushing up against the vertical wall.
  5. Physics glitch

    Anyone else experienced this, even if it hasn't been resolved? It's kind of a deal breaker, quite surprised that the arcade physics engine fails in such a simple scenario, hence I'm thinking I've done something wrong
  6. Physics glitch

    Hi, I'm new to Phaser, but a seasoned games programmer. Seems like a great framework so far, but I'm experiencing a glitch in the Arcade physics engine which I'm not sure is a bug, or down to the way I'm manipulating the body's velocity in code. I've setup a sprite object and strips of horizontal & vertical wall blocks, all of which are enabled in the physics engine. The walls are immovable. If I move my sprite up, it will eventually hit a wall, but with the up key held I can still use the left & right keys to move the sprite smoothly against the wall. If I do the same thing against the vertical wall, the up and down movements get stuck at the edge of some of the wall blocks if I keep the right key pressed. Here's a example... http://cam64.net/temp/phaser/default.html ...and here's the code. Is it a bug, or am I doing something wrong? var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update }); var walls; var player; function preload() { game.load.image('playerImage', 'Images/sprite.png'); game.load.image('wallImage', 'Images/block.png'); } function create() { // Start physics engine game.physics.startSystem(Phaser.Physics.ARCADE); // Setup walls group walls = game.add.group(); walls.enableBody = true; // Create horizontal and vertical wall blocks for (i = 0; i < 9; i++) { var w1 = walls.create(i * 64, 0, 'wallImage'); w1.body.immovable = true; var w2 = walls.create(576, i * 64, 'wallImage'); w2.body.immovable = true; } // Create player player = game.add.sprite(250, 250, 'playerImage'); game.physics.arcade.enable(player); player.body.maxVelocity.setTo(300, 300); player.body.collideWorldBounds = true; } function update() { cursors = game.input.keyboard.createCursorKeys(); // Move left and right if (cursors.left.isDown) { player.body.velocity.x -= 50; } else if (cursors.right.isDown) { player.body.velocity.x += 50; } else { player.body.velocity.x = 0; } // Move up and down if (cursors.up.isDown) { player.body.velocity.y -= 50; } else if (cursors.down.isDown) { player.body.velocity.y += 50; } else { player.body.velocity.y = 0; } // Update collisions game.physics.arcade.collide(player, walls); }