Jump to content

Positioning Background Image on Canvas Correctly


Recommended Posts

Hi guys i am trying to load a background image on canvas and position game camera on certain position and zoom level.

This is the example background image:


When i load the image it looks like this:




I want to set position of background image (or camera ? )like this:


Canvas is 800x600

const preload = () => {
  game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;

  game.load.image("background", "http://i.hizliresim.com/3zYlaA.png")


const create = () => {
  cursors = game.input.keyboard.createCursorKeys();

   background = game.add.tileSprite(0, 0, 800, 600, 'background');
    //  Creates a layer from the World1 layer in the map data.
    //  A Layer is effectively like a Phaser.Sprite, so is added to the display list.



Link to comment
Share on other sites


  • Recently Browsing   0 members

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