The scroll to behavior

Get help using Construct 2

Post » Mon Apr 15, 2013 7:02 pm

Hi, for my game I wanted to be able to walk around and spawn another character in that you can control.

And I want that the camera is focusing on the player that you are currently controlling. But I don't know how to.
Right now I have 2 characters that both have the "Scroll to" behavior and the camera is trying to keep them both in frame. And in the event menu there isn't something called "ignore scroll to" or something similar like that.

Thanks in advance,

Vincent.
B
3
Posts: 3
Reputation: 331

Post » Mon Apr 15, 2013 7:49 pm

I wanted to make a tutorial about character switching for quite a while.
When you press the change the character button, you must destroy the previous character sprite
you controlled and spawn another sprite in the same place where the character was destroyed called UnplayableCharacter0. That unplayable character0 sprite is a clone of the character sprite, with 2 exceptions:
1. It has no Scroll To behavior.
2. It is not controllable. Not necessary to delete the Platform behavior, however! Just turn off the default controls for the Unplayablecharacter0 sprite and let the gravity consume it (whatever).
Hope you understood. If you didn't, reply to me and tell me to send you a .capx where I did this thing.
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Mon Apr 15, 2013 8:03 pm

The easiest way is put them all inside a family, and make an boolean variable for the family.

Whenever you switch the controlled sprite, switch this variable to ON or OFF, and the new controlled thing ON, set the camera to check the family instance variable with the Boolean ON and make it follow the "family" and not the sprite.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Mon Apr 15, 2013 8:23 pm

In this scenario, I'd probably drop the scroll to behavior all together, and implement my own with events. Something like this:

Demo
Capx

The demo is really just for 2 sprites. If you're looking to switch between more than 2, I'd use families as TELLES0808 suggested.
B
44
S
13
G
7
Posts: 338
Reputation: 10,379

Post » Wed Apr 17, 2013 5:27 am

@zatyka your example is tight!

Why doesn't the Scroll To behavior have an action to disable it?
B
11
S
2
G
2
Posts: 26
Reputation: 2,974

Post » Wed Apr 17, 2013 5:29 am

I agree as well. This would be a nice feature to add to the ScrollTo behavior.
Project Lead of Zems Online Card Game

Producer at Impulse Limited
B
18
S
6
G
3
Posts: 677
Reputation: 5,194


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Artpunk, indiegrimes, NRABrazil, PixelatedTrip and 25 guests