Jump to content

Movement of the camera does not work


Grom
 Share

Recommended Posts

Help me please.

var cord = {x: 0, y: 0}, pos = {x: 0, y: 0};var game = new Phaser.Game(w, h, Phaser.AUTO, '', {            preload: preload,             create: create,             update: update,             render: render         });function preload() {        /*...*/}function create() {        game.world.setBounds(-5000, -5000, 5000, 5000);}function update() {        if (game.input.mousePointer.isDown) {            pos = {                x: game.input.x - cord.x,                y: game.input.y - cord.y            }                   game.camera.x = pos.x            game.camera.y = pos.y        }        if (game.input.mousePointer.isUp) {            cord = {                x: game.input.x - pos.x,                y: game.input.y - pos.y            }        }}function render() {        /*...*/}

the camera does not move. :(

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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