How do I set an "offset" for Scroll To behaviour?

0 favourites
  • 4 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello! Im new to the forum (noob)

    I need a little help with centering my character. I have used the Scroll To behaviour, and it works wonderfully, centering my character in the window. The problem is that I have added a UI on the right side of the screen, which obscures about 1/6 of the game window. This means that the player cant see as much to the right of him as he can to the left, which is quite annoying. I would like it if it's possible to use the Scroll To behaviour to center the character between the left edge of the UI window and the left edge of the window.

    Any help in this matter will be much appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Currently, there is no way to do this with the "Scroll To" behaviour.

    But you can do the following:

    • Remove the ScrollTo behaviour
    • Add an event "Every tick"
    • Under that event, add the action "System: Scroll to position
    • As X and Y, insert the X and Y coordinates of your player. Now, you can add the offset

    This could look like this:

    Every tick:
    -----Scroll to    Player.X+50 ,  Player.Y
    [/code:vbuw0rm6]
  • You can also add the scoll to behavior to a separate sprite then set the player's position in relation to that sprite.

  • Thanks a lot for the help

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