Camera follow 2 or more players

0 favourites
From the Asset Store
Players follower. use it for anything which follows the player
  • 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

  • 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

  • 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.

  • 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.

  • 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.1

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Basically is a platform game that I'm working on it. ( 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 ;)

  • Alternatively, you could take a look at my Magicam plugin - it supports following an arbitrary number of objects with custom constraints and movement smoothing.

  • Humm, let me take a look :)

  • How can I stall your plugin?

  • 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 :)

  • You can add the Scroll To behavior to 2 or more objects and it scrolls to the mid-point of all the objects. I just checked and it definitely works.

  • arcgen - Thanks, man - let me know if you have any problems with it.

    Ashley - That takes care of scrolling, but it doesn't zoom the camera to keep all of the objects on the screen, which is one of the things Magicam handles.

  • did u use the scroll to behaviors or the scroll to function

    and another problem you might also be having is u don't have unbounded scrolling and one of them is going out side the layout

    also to zoom out u use the set layer scale or layout scale and just slightly decrease it if both or either players are outside the box

    then have a inner box and i they are both in it to slightly zoom in until the max amount for zooming in

    to tie the two players to together you give one of them the pin behavior and pinit to the other player rope style in the events

  • Sorry my delay guys. I had a couple of busy days in a row.

    Ashley - It works, and I made some tests to have a auto-scroll on rail camera based on triggers. The zoom is the only issue right now. I know how to scale the layout, but how can I make a transition between the zoom levels using just the engine without plugin?

    linkman2004 - Your plugin is great and it fits in almost everything that I need. I still have some doubts about some issues and I sent you a private message about it. Thanks!

    sosensible - I used the behavior. To resolve the layout edge problem I made a invisible collision on a fixed layer that doesn't allow the players to leave the layout when they are too far from each other. Isn't the best solution, especially because you have to use it on the max Zoom Out to work well.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)