Constrain to scrolling screen

ktortiktorti Member Posts: 27

I have an invisible actor which slowly moves up the screen in which the camera follows. I also have another actor which is free to move about the screen. I want to constrain the free moving actor within the screen and around the invisible actor. Right now I have the second actor constrained within the 0-768 range on the x axis so he can't move outside of the screen. I'm having trouble figuring out the y axis though.

I made two real game attributes to constrain the invisible actor. game.CamControllerX constrained to self.positionx game.CamControllerY constrained to self.positiony My understanding is that this keeps track of it's x and y coordinates at all times. Now I'm just trying to figure out how to make it so that the second actor, the free moving one, will be constrained on the y axis around the invisible one so that when the invisible one is moving the camera, your free moving actor won't fall behind the camera. Suggestions?

Sign In or Register to comment.