Following the Camera

homelesswombathomelesswombat Member Posts: 73
edited November -1 in Working with GS (Mac)
Is there a way to call the x,y coordinates of the camera? I want to make a background that moves relative to the camera to create the illusion of distance. I want to constrain actor.background.x,y constrained to the camera.x,y÷10, but the actor expression editor won't let me access scene attributes. Anyone know how to do this?

Comments

  • synthesissynthesis Member Posts: 1,693
    To access scene attributes...you have to unlock the scene actor's rule editor...however, once unlocked...it no longer is tied to the seed actor. its a "dangerous" option but doable. I try to avoid scene attributes at all costs if possible and rarely modify actors within a scene.

    For actor controls...I usually use a transparent "dummy" camera actor tied to my main actor or use the main actor itself...whichever makes more sense for the scene.

    use scene layers to control what moves with the camera and what doesn't.

    TIP:
    Use an actor attribute called "actorID" to make clone actors respond differently depending on their ID. Then modify the actor ID number within the scene to assign unique actor rules within the actor. This allows you to keep actors in their original/unmodified form within a scene and they will receive continuous rule revisions throughout development of your game. This allows you to avoid unlocking the rules of the actor...which once that happens...the actor is no longer tied to its seed actor and revisions get more complicated and time consuming down the road.

    I will post this tip as a new thread
  • homelesswombathomelesswombat Member Posts: 73
    Thanks Synthisis, I really like your dummy actor solution. I might not use it though since I'm only using one background image. Then again I might if I want to make other things in the background look farther away.

    The layering solution is good if you want something to follow the camera exactly. For a background image though I want to

    Constrain
    self.position.x to camera.position.x/10
    self.position.y to camera.position.y/10

    So you get a background that moves slower than the camera, giving the illusion of distance.
Sign In or Register to comment.