How do I zoom in without changing layout size/coordinates?

Get help using Construct 2

Post » Wed Apr 23, 2014 3:40 pm

I have a game where you point and click and an object moves to it (using a target object for my player character to move to using bullet behaviour. Player stops when it hits target until the next click is made).

I also want to have a zoom function to gradually zoom in on the player when certain parameters are met.

I've got both of the above working, but the only problem is that I'm finding that parts of the layout become inaccessible.
i.e. when zoom on the layer is up to 1.5 or so, I can't get my player character to move to the top left of the layout - it's become inaccessible.

ScrollTo behaviour is being used on the player to control the camera.

Until I tried doing the zoom effect ,everything was working fine.

Does anyone have ideas on how to solve this?

Thanks for your time in advance.
B
6
S
2
Posts: 55
Reputation: 614

Post » Wed Apr 23, 2014 3:45 pm

Unbounded scrolling
By default the game window cannot scroll past the edges of the layout. Set this to Yes to allow unlimited scrolling in any direction, even past the edges of the layout.
https://www.scirra.com/manual/67/layouts
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Wed Apr 23, 2014 3:49 pm

Thanks for helping out @granpa

Then the problem now is that I can see loads of empty space beyond where I couldn't before, when I'm unzoomed!

2 solutions to this I suppose:
1) Just put big dark blocks there to symbolise the boundaries of the game area.
2) Change unbounded scolling on the fly if that's possible.

What do you think?

What does anyone else think?
B
6
S
2
Posts: 55
Reputation: 614

Post » Wed Apr 23, 2014 4:03 pm

Scroll to position
Scroll to X
Scroll to Y
Set the X and Y positions to center the view on. This scrolls all layers taking in to account their parallax property.
clamp(x, lower, upper)
Return lower if x is less than lower, upper if x is greater than upper, else return x.
scroll to clamp(player.x,whatever,whatever)
scroll to clamp(player.y,whatever,whatever)
Play with this , might work .
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Wed Apr 23, 2014 4:31 pm

Not sure that I understand what you've written there entirely @granpa.

Thanks for your help, but could you explain a little bit more or elaborate on what you've written above?
B
6
S
2
Posts: 55
Reputation: 614

Post » Wed Apr 23, 2014 4:53 pm

You found out what unbounded scrolling does so now you control it manually. The scroll to x and scroll to y let you do just that ! By using the clamp() with your player x and y along with the scroll to action's your saying scroll to player x or y unless the player gets beyond a point where you don't want to scroll any more , otherwise you see the areas that you rather not see anymore . The first parameter of the clamp will be the player's x or y position , the next parameter the minimum position left or top of your layout and the last parameter the max position of your right or bottom of your layout respectively . This way it scrolls with your player like normally and stops scrolling when the player get's beyond that point where it normally would have stopped if unbounded scrolling was turned off , this is usually the halfway point of your view port . So if you have a bigger layout that your view port you will have to input the parameters in the clamp () comparator after figuring them out .

Hope i did not lose you ,if someone can explain it better then please do !
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests