How do I Toggle Between Characters in the same position?SOLV

0 favourites
  • 10 posts
From the Asset Store
Toggles Dials Switches and Alerts ! A foundational sound grouping of Analog type switches and Steampunk effects
  • Hello! So, what I would like to do is have the ability to toggle between three characters with a click of the space bar.

    So, it would be like switching between weapons, but instead, it is alternating different character sprites each with it's own animations.

    I found this tutorial and it is a great way to switch between characters but all the characters are in different areas of the layout and are visible.

    What I would want is being able to switch characters and always have them in the same position, but only seen when you toggle between them.

    I hope my question makes sense, and sorry if this is a question that was already answered.

    I am currently still trying to solve this problem but new to construct still.

    Thanks!

  • Well, perhaps the simplest way would be to have separate objects for the different characters, then on character change spawn the new character right on top of the old one and destroy the old one.

  • hmm I tried it, but then I'm unable to cycle back to character 1

    here is my file: For time's sake, I am using the tutorial from above, and I tweaked the behavior's to spawn the new character and then destroy the old one.

  • crap, nevermind, I dont have a high enough reputation to post urls.

    Here's what I did.

    So again, I can go through each character, but I cant go back to character 1

  • Hey Sand.

    Still can't see your links but what I recommend is to have 2 global variables "PartyTotal" and "PlayerSelected" and an instance variable on your characters : "Player".

    On space pressed -> Add 1 to PlayerSelected and pick the player that is equal to this number to focus on. If the player selected number is greater than the total, you can set it back to the lowest number instead before picking.

  • I found a solution, but I will also try this!

    Links aren't showing up because my rep is very low.

    Thanks yo!

  • Hey Sand.

    Still can't see your links but what I recommend is to have 2 global variables "PartyTotal" and "PlayerSelected" and an instance variable on your characters : "Player".

    On space pressed -> Add 1 to PlayerSelected and pick the player that is equal to this number to focus on. If the player selected number is greater than the total, you can set it back to the lowest number instead before picking.

    While this does solve the ability to pick another character, is there a way to just press the spacebar and then have another character change places with the first spontaneously?

    I tried a different method of spawning and then destroying, but when I try to go to the first character, there are duplicates.

    Thanks.

  • I think this is what you are after : https://db.tt/7K9vXUHZ

    This is one object with multiple animations but you could just as easily have different objects for your other characters and destroy one and create another as you pressed space. If you are going that route you should have an invisible object as your base, when space is pressed, destroy all character objects and have the invisible object spawn the right character. The newly created object then gets pinned to the base.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • THANK YOU SO MUCH.

    Ah, I forgot about the invisible player pinning method. Gosh, Construct is simple to use but if I don't keep working at it, then I'll forget behaviors and actions.

  • For those that are more visual learners and need it, I made a capx .

    Once again thanks GenkiGenga!

    https://www.dropbox.com/s/qyfdlmoct78d6sy/MultipleCharacterSwap.capx?dl=0

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