Page 1 of 1

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

PostPosted: Wed Jul 22, 2015 9:50 pm
by Sandftw
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!

Re: How do I Toggle Between Characters in the same position?

PostPosted: Wed Jul 22, 2015 10:18 pm
by Sup with that?
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.

Re: How do I Toggle Between Characters in the same position?

PostPosted: Wed Jul 22, 2015 11:10 pm
by Sandftw
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.

Re: How do I Toggle Between Characters in the same position?

PostPosted: Wed Jul 22, 2015 11:15 pm
by Sandftw
crap, nevermind, I dont have a high enough reputation to post urls.

Here's what I did.

Image


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

Re: How do I Toggle Between Characters in the same position?

PostPosted: Wed Jul 22, 2015 11:24 pm
by GenkiGenga
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.

Re: How do I Toggle Between Characters in the same position?

PostPosted: Wed Jul 22, 2015 11:33 pm
by Sandftw
I found a solution, but I will also try this!
Links aren't showing up because my rep is very low.

Thanks yo!

Re: How do I Toggle Between Characters in the same position?

PostPosted: Fri Jul 24, 2015 10:10 pm
by Sandftw
GenkiGenga wrote: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.

Re: How do I Toggle Between Characters in the same position?

PostPosted: Fri Jul 24, 2015 11:42 pm
by GenkiGenga
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.

Re: How do I Toggle Between Characters in the same position?

PostPosted: Mon Jul 27, 2015 4:48 pm
by Sandftw
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.

Re: How do I Toggle Between Characters in the same position?

PostPosted: Mon Aug 03, 2015 10:57 pm
by Sandftw
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