How do I make a camera blocking region

Get help using Construct 2

Post » Mon Jul 17, 2017 10:29 pm

Alright, this is kinda a catch, been trying to make a camera in construct 2 work by having an object type define areas the camera is not allowed the scroll into but the camera should also track the player so the camera will need to treat the blocking objects as if they are edges of the layout.

Currently I have the camera set every tick to center on the player, so I can calculate the position before I commit it to the layout.
Thanks in advance for any help.
B
4
S
1
Posts: 15
Reputation: 384

Post » Tue Jul 18, 2017 9:32 am

I think the simplest way to do this might be to have the camera track an object the size of the screen. Have this object always pathing towards the player. When it overlaps areas that shouldn't be seen by the camera, steer it away from those objects. Good luck! :)
The LEVEL GENERATOR TOOLKIT



24 functions dedicated to producing randomly generated terrain for all kinds of games.
B
25
S
7
Posts: 245
Reputation: 2,314

Post » Sat Jul 22, 2017 6:07 pm

Hello, a quick update to the solution I did, while not a perfect solution if one is changing zoom, it might be of use to someone else to know the slightly odd means that I used, with a few tweaks you can even tweak it to find each edge.

The camera region its self was a 1x1 image, with four image points representing its edges, it also contained information for how much to offset the camera by on the Y axis(one can also add the X axis to the same concept).

Then each tick, from the players position(Not the invisible object representing the camera) I checked a point using a system statement exactly 128 pixels under the player(used 128 as it seemed to cause the least amount of camera snapping as I lerp the camera), if the statement picks more then one object in the particular group, it will use its top image point-Y offset to position the camera, otherwise use the players X and Y.

If this confuses anyone I will see if I can clean it up, likely a bit rube Goldberg for most cases.
B
4
S
1
Posts: 15
Reputation: 384


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 21 guests