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

Just started using Construct 2? Post your questions here

Post » Mon Dec 19, 2016 10:05 pm

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.
B
3
Posts: 10
Reputation: 195

Post » Tue Dec 20, 2016 12:18 am

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:
Code: Select all
Every tick:
-----Scroll to    Player.X+50 ,  Player.Y
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Tue Dec 20, 2016 6:38 am

You can also add the scoll to behavior to a separate sprite then set the player's position in relation to that sprite.
B
25
S
16
G
26
Posts: 125
Reputation: 16,103

Post » Tue Dec 20, 2016 3:41 pm

Thanks a lot for the help :)
B
3
Posts: 10
Reputation: 195


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest