How do I make the camera follow player only inside layer

Get help using Construct 2

Post » Thu Sep 18, 2014 7:30 am

Hello,

If I set the player behaviour scroll to the camera centers the player, but it displays portions outside of layer when the player is close to the edge.

I want the camera to follow the player as it is now but to stick inside layout.

How can I do that?

Thanks
[size=200]1. Best Construct 2 course :HERE.10$!

2. 155 games source codes for sale on scrira store 12,86$each. PM me if interested to speed up the uploading process.
[/size
B
34
S
8
G
4
Posts: 156
Reputation: 3,779

Post » Thu Sep 18, 2014 7:37 am

I've never had this problem with the scroll to function, are you sure its not because you have your layout smaller than your screen size? Or maybe you have your layout bigger than your level? The scroll to function goes off the Layout width and height, and I have just tested it and it stops as soon as it hits the layout edge. Any screenshots that might help?
B
7
S
1
Posts: 61
Reputation: 567

Post » Thu Sep 18, 2014 8:17 am

I solved this by adding a sprite called camera with bound to layout and scroll behavior and every tick camera x set to player.x and camera y set to player .y
[size=200]1. Best Construct 2 course :HERE.10$!

2. 155 games source codes for sale on scrira store 12,86$each. PM me if interested to speed up the uploading process.
[/size
B
34
S
8
G
4
Posts: 156
Reputation: 3,779

Post » Thu Sep 18, 2014 8:38 am

You might want to try pinning the Camera sprite to your player as the 'every tick' function can take up valued memory resources, especially if your going to be putting your game on a mobile device. :)
B
7
S
1
Posts: 61
Reputation: 567


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 36 guests