Camera follow 2 or more players

Get help using Construct 2

Post » Wed May 15, 2013 8:04 pm

Hello everyone,

Is it possible to have a camera that follows 2 or more players? Are there a good solution to work on it? Maybe a camera that follow something between the character to maintain it in the middle of the screen. Any suggestions?

Thank you
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Wed May 15, 2013 8:12 pm

just set the scroll to behavior on both of them and if their to far apart just have the layout zoom out or have them pinned to each other rope syle
B
39
S
10
G
7
Posts: 514
Reputation: 9,426

Post » Wed May 15, 2013 10:30 pm

You could have an invisible sprite that acts as the camera, set scrollTo to it. Then based on comparisons (like distance of the two characters) have the camera do something, like zoom out.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu May 16, 2013 9:21 am

Sosensible - The scroll behavior doesn't work on 2 actors at the same time. It is following the P1, but not the P2. The rope style and Zoom could work, but how can I make it? I couldn't find any zoom option on C2 so far.

ArcaEd - It would be perfect! Especially if I can control the invisible sprite on tracks or doing auto scrolls sometimes. Could you help me how to make it? I don't know how could I make the comparison between the characters.
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Thu May 16, 2013 10:31 am

arcgen

We can help you to make that, but you have to provide us informations where you have the problems.

Here is a possible beginning:

+ Every tick
--> Set position invisible to (Player1.X - (distance(Player1.X, Player2.X)/2), Player.Y)
--> Scroll to invisible

//This would Scroll to the point between Player 1 and Player 2, you just need to make "more conditions" like:
- Are the players after the scroll still on the screen ? If not scale out

This could (hope so) done by adding this line to the every tick:
+ WHILE familly Player is outside Layer //Dont forget to add all Player Sprites to 1 familly
--> Set Layer scale to scale + 0.1Darklinki2013-05-16 10:32:19
B
15
S
6
G
6
Posts: 512
Reputation: 5,550

Post » Thu May 16, 2013 2:05 pm

Basically is a platform game that I'm working on it. ( http://www.arc-gen.com/games/work-in-progress-game/ ) Now I'm trying to improve the camera and implement a 2 players mode (maybe 4 players).

The idea is to have 2 or more players on screen; They can't be too far from each other or even leave the screen (there will be a maximum far limit between them; The camera will be always between the players; Sometimes there will be auto scrolls levels that the camera will just move without the players influence. It's basically this.

I'll try to implement your way now. Right now I'm trying to do it on a independent project just to test the gameplay. If it works, I'll put it on the game ;)
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Thu May 16, 2013 2:10 pm

Alternatively, you could take a look at my Magicam plugin - it supports following an arbitrary number of objects with custom constraints and movement smoothing.
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu May 16, 2013 2:32 pm

Humm, let me take a look :)
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Thu May 16, 2013 2:58 pm

How can I stall your plugin?
B
13
S
2
Posts: 104
Reputation: 1,336

Post » Thu May 16, 2013 3:24 pm

Dude! Your plugin is awesome! :D Let me try to use this :)
I sure I'll have some doubts about it during the development.

Thank you :)
B
13
S
2
Posts: 104
Reputation: 1,336

Next

Return to How do I....?

Who is online

Users browsing this forum: WhosWho and 18 guests