camera and actor

rubber-chickenrubber-chicken Member Posts: 12
edited November -1 in Working with GS (Mac)
Im trying to create a running game. Im not sure how to keep the character to the a third of the screen while the camera pans to the right across the scene.

Please help

Comments

  • GraybayGraybay Member Posts: 114
    Ahead of your player, I would place an actor at the distance you would like the camera to be, it doesn't have to be exact because we are about to make a constraint that will put it in position anyways. Make a game attribute representing your player's X coordinate, call it player_X. In your player actor, use a constrain attribute to constrain the attribute you just made (player_X) to your players self.position.x. Now go into the actor you just created for the camera to follow, this time constrain this actor's self.position.x, open the expression editor for the "To" attribute. add game.player_X then right after that place a +100, then click the check mark. next, place a "control camera" attribute on this actor, make sure you don't already have one on your player actor. If you hit preview, the camera should now be ahead of your character when he moves, you can adjust the (+100) to more or less to change the distance from player to suit your needs. As an added note, don't forget to adjust your camera in camera mode, it looks like a little video camera and is located above your scene editor window, below the preview button. Hopefully I didn't forget anything.

    Good luck!
  • UtopianGamesUtopianGames Member Posts: 5,692
    Check out our free runner game over at DBA, we constrain the camera so the player is over to the left of the scene.

    Darren.

    image
Sign In or Register to comment.