How do I scrollto in a limited area

0 favourites
  • 5 posts
  • Hi,

    I have 2 players with joystick.

    I wish to use a scroll to behavior for player1 in a limited area and the same for player 2 in another limited area.

    Can you help me ?

    Best regards from France

  • Could you please elaborate more what do you mean by limited area?

    On the basic, any object with scrollto behavior will have the camera centered on. If two objects have scrollto behavior, the camera will be centered at the midpoint between the two objects. However, if these objects are so far apart, you won't be seeing these objects.

    Personally, I would prefer to have only one Camera object and control everything myself with events. But before we could help you validly, could you please elaborate more about your game? This is so we could help you validly.

  • HI,

    Here is a picture

    It's a face to face game. The player 1 must scroll to into the pink zone only and the player 2 in the blue zone independantly when each player use the joystick ( little circle). Do you think i can use the scrollto behavior to do this. thank you

  • In that case, scrollto behavior is not what you are looking for. ScrollTo is for camera.

    What you want to use is probably Bullet behavior, and then use events to limit the players to their areas.

    One possible way (not the best way but an easy one) is:

    if player1.x > LayoutWidth / 2

    player1.x = LayoutWidth / 2

    if player2.x < LayoutWidth / 2

    player2.x = LayoutWidth / 2

    This will make player 1 not able to move to the right half of the screen and make player 2 not able to move to the left half of the screen.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks ! I will do my best !

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