Actor cant go out of the shot
beefy_clyro
Member Posts: 5,394
Hi All. Im creating a game which just scrolls along, much like the shootemup demo. Im having problems keeping my actor staying in the camera view area. I downloaded the shootemupdemo which was fixed to stop the actor going out of side, however i cant get it working on my project. I tried to copy what i thought was contolling it but my actor still goes out of sight. I know it should be controlled via attributes but have only just used my first attributes to control a d pad so am very new in this area. On the demo, there was attributes and in the rule it calls on the attributes -200 (i had no idea why that was there), i tried to copy the attributes and rule, with and without the -200 but made no difference, my actor still went out of shot. Could someone please be a saint and upload me a very simple demo which only shows the necessities to have the actor staying in the camera view of a scrolling scene? Thanks in advance
Comments
In your control camera actor place a rule that says constrain game.cameraX to self.position.X
Then in your player create a rule that says when attribute self.position.X is </= game.cameraX-240 change attribute self.position.X to game.cameraX-240.
So when it gets to the edge of the screen (240px away from the center) it can't go past the screen.
Haven't tried this but it seems like it may work.