Jump to content

Char movements seems to slow on reaching worldbounds


Recommended Posts


I am building a small Phaser game. For fun;) 

I got one problem: I focus my camera on my character, but when I near the edge of the map the characters speed "seems" to increase greatly (and decrease as soon as the camera starts moving of the edge again). I think this has to do with the camera abruptly stopping when on the edge of the map (so the cam stops but char moves on) 

Is there a way to make the camere go "over the edge", like, half or so? Cause this looks a bit crappy;)

Underneath I posteed the code (I took out the parts which have nothing to do with this issue:)


Anyone got an idea or a sollution for me? (Btw: I am using Tiled to create a Json map which I imported into my program.)


create: function () {

game.world.setBounds(0, 0, 2560, 2560);


    this.map = game.add.tilemap("GameWorld1616", 16, 16, 160, 160);

    this.map.addTilesetImage("Market2", "Market2");
    this.map.addTilesetImage("Tree1", "Tree1");

     this.layer1 =  this.map.createLayer("GroundLayer");
     this.layer2 =  this.map.createLayer("Roads");
     this.layer3 =  this.map.createLayer("TreesFront");
     this.layer4 =  this.map.createLayer("TreesBack");
     this.layer5 =  this.map.createLayer("Collision");

 player = game.add.sprite(game.world.centerX, game.world.centerY, avatar);



 player.body.collideWorldBounds = true;

 cursors = game.input.keyboard.createCursorKeys();  

 this.menuFactory('Return', function () {


update: function() {


   //  Reset the players velocity (movement)
    player.body.velocity.x = 0;
    player.body.velocity.y = 0;

    if (cursors.left.isDown)
        //  Move to the left
      player.body.velocity.x = -500;

    else if (cursors.right.isDown)
        //  Move to the right
       player.body.velocity.x = 500;




Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...