Jump to content

Black bar appearing at the top and rightside of canvas


Recommended Posts

I've used a Tiled Map with my project before and it worked perfect, however the second map I made has a black bar on the right and top. I can move into the black space but the Camera will not allow me to move left off screen.

My canvas is set to this resoltuion

var game = new Phaser.Game(640, 480, null, 'gameDiv');

This is how I load my assets

  preload: function() {

    game.stage.backgroundColor = '#000000';

    game.load.tilemap('level0', 'assets/map/Level0.json', null, Phaser.Tilemap.TILED_JSON);
    game.load.image('tiles0', 'assets/map/[TILESET]Dirt-City.png');


This is the code in my play.js create function.

    create: function () {    
          var map = game.add.tilemap('level0');
          map.addTilesetImage('[TILESET]Country', 'tiles0');
          this.layer = map.createLayer('Tile Layer 1');
          game.world.setBounds(0, 0, 640, 4800);

          this.player = new Player(300, 4700);

My camera updates it's location based on that of the player like so

  player.update = function() {
    game.camera.x = this.x - 150;
    game.camera.y = this.y - 300;



I have been trying to figure out this problem for quite some time, any help is greatly appreciated. Thank you.

Screenshot-2018-3-11 CodeFarmer(1).png

Screenshot-2018-3-11 CodeFarmer.png

Link to comment
Share on other sites


  • Recently Browsing   0 members

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