Following the Camera
homelesswombat
Member Posts: 73
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
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
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.