Jump to content

when background fixed to camera camera follow doesn't work


Santiago
 Share

Recommended Posts

Hello, I got a simple game where a player moves and have a camera following it.

Now, when I put a background and I want it to set it static while player moving, produce 2 things I don't want: the camera.follow(player) stop working and in the middle of the world the player stuck like a few seconds as a bug or something, and then continues.

//Background ("fondo" is the background, if you don't know)
this.fondo = game.add.image(0,0, 'fondoGame');
        this.fondo.fixedToCamera = true;
        this.fondo.cameraOffset.setTo(0,0);
        this.fondo.scale.set(2);

//PLAYER
        this.player = game.add.sprite(50, 100, 'vikingo');
        this.player.anchor.setTo(0.5, 1);
        
        game.camera.follow(this.player);
        
        game.physics.arcade.enable(this.player);
        this.player.body.gravity.y = 800;

I did a research but couldn't find something that could help me.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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