How do I make the second player not be able to leave the screen?

0 favourites
  • 3 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • So this is my first game im making with construct and its a 2 Player (local) platform game.

    Everything I have made for the game so far works fine, movement, objects, collision, etc.

    But I am unsure how to stop player 2 from leaving the screen. (i think its called viewport)

    Basically I want to know how to make a border for the screen that will stop player 2 from leaving it.

    I have looked through the events and cant find anything like: If player 2 is at edge of viewport, make edge of view port solid or something.

    So I am out of options.

    Thanks if you can help!

  • There are some built-in behaviors that might help you:

    • Bound to layout will prevent the character from going outside of the layout (works if your layout has the same size as your viewport
    • Wrap that will make the character reappear on the opposite side of the screen/layout/viewport. This could be of help.

    Otherwise, you might post your project (.c3p file), that will make it easier to provide a solution in regards to the specifics of your project.

    From the sound of it, you assigned the camera (Scroll to ?) to your character 1, and likely will have to handle whether player 2 control input should happen, in regards to the position of the character to the side of the screen, relative to the current position of player 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Kyatric Yeah I was thinking about stopping player 2 input when at a certain distance from player one, but I have decided to add scroll to to both players so that it sort of focuses on the point inbetween them and make the layout zoom out so there's space.

    Maybe later i'll try to figure out a way to have a border applied to the viewport and stop both players from leaving, but what i've got right now should work for now.

    Thanks a lot for your help!

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