The scroll to behavior

  • 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.

  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • zatyka your example is tight!

    Why doesn't the Scroll To behavior have an action to disable it?

  • I agree as well. This would be a nice feature to add to the ScrollTo behavior.

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