Finwillwin

Phaser Camera Won't Respond At All!

Recommended Posts

I have tried to move the camera manually by doing

game.camera.x += 1;

in the console in Chrome and Edge on both a Chromebook and PC.  I can't get the camera to move at all. I am using Phaser CE. Here is my code:

var hub = {
    create: function(){
      if(game.mode == "vga"){
      game.stage.backgroundColor = "#3d8bff";
      }
      top = game.add.sprite(-256, 0, 'top');
      bottom = game.add.sprite(0, 448, 'bottom');
      game.movement = "hold";
      holdTimer = 4;
      holdStage = 0;
      stone = game.add.sprite(0, 0, 'stone');
      hand = game.add.sprite(344, 354, 'hand');
      },
  update: function(){
    if(game.movement == "hold"){
     holdTimer -= 1;
     if(holdTimer == 0){
      if(holdStage == 0){
      stone.x = 276;
      stone.y = 282;
      hand.frame = 0;
      holdStage += 1;
      }
      else if(holdStage == 1){
      stone.x = 280;
      stone.y = 304;
      hand.frame = 1;
      holdStage += 1;
      }
      else if(holdStage == 2){
      stone.x = 272;
      stone.y = 320;
      hand.frame = 2;
      holdStage += 1;
      }
      else if(holdStage == 3){
      stone.x = 252;
      stone.y = 340;
      hand.frame = 3;
      holdStage += 1;
      }
      else if(holdStage == 4){
      stone.x = 236;
      stone.y = 366;
      hand.frame = 4;
      holdStage += 1;
      }
      else if(holdStage == 5){
      stone.x = 252;
      stone.y = 340;
      hand.frame = 3;
      holdStage += 1;
      }
      else if(holdStage == 6){
      stone.x = 272;
      stone.y = 320;
      hand.frame = 2;
      holdStage += 1;
      }
      else if(holdStage == 7){
      stone.x = 280;
      stone.y = 304;
      hand.frame = 1;
      holdStage = 0;
      }

     holdTimer = 4;
     }
     }
  },
};

Is anyone else experiencing this problem with Phaser CE and how do you remedy it?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.