Advanced Camera Controls?

LikeABossAppsLikeABossApps Member Posts: 1
edited February 2012 in Working with GS (Mac)
Hey Everybody!

I'm developing a landscape platformer like Mario, and I'm using the camera control to follow my main character along the 9000pixel wide scene. I have my camera set up to the typical 960 x 640 and the 'tracker box' in the middle is set up to 100 x 300 pixels. When my main character falls into that box the camera follows him, like it should, but, the problem is, by then, he's already half way through the screen and when you run along, you haven't got a chance to see the bad guys before they're melee attacking you...

Is there a way to contain the main character either a quarter or a third of the screen off of the left hand side of the edge? I've tried moving the camera box but it also moves the right side of the box, making it worse.....

Would be prefect !!!!!
Thanks in advance guys!!!

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    Here's what I would. Unlock an actor's instance that is in the scene. It could really be any actor or create a new actor called CameraControl. Make it invisible and nonmoving. Then drag it into the scene double click on it and unlock it. Then drag two constrain behaviors into the main area.

    Constrain current.scene.camera.origin.X to curent.scene.layers.background.mainplayer.position.X - 100
    Constrain current.scene.camera.origin.Y to curent.scene.layers.background.mainplayer.position.Y - 100

    Now here's the HUGE WARNING! - when you go into the layers section under current scene and use an attribute from another actor you must NOT create or reorder any layers in this scene. So make sure you have all layers in place before doing this. you can still add actors to any layers and you can also reorder actors within the same layer but if you move the actor that you are referencing to a new layer it will break this code and you will have to redo it. As long as you keep this in mind you will be good to go and this method uses the fewest constrains.

    Good luck!
  • LikeABossAppsLikeABossApps Member Posts: 1
    I've followed your instructions to best I can understand and I'm failing somewhere. after all is done, I go back to the main screen and hit preview, the character is half off the left hand side of the screen, he runs right, and the camera doesn't move, and he runs off the right hand side of the screen... :( !!!
Sign In or Register to comment.