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

Get help using Construct 2

Post » Wed Jul 22, 2015 9:50 pm

Message: Sandftw is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
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!
Last edited by Sandftw on Fri Jul 31, 2015 9:05 pm, edited 1 time in total.
B
6
Posts: 15
Reputation: 277

Post » Wed Jul 22, 2015 10:18 pm

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.
B
52
S
24
G
18
Posts: 295
Reputation: 13,090

Post » Wed Jul 22, 2015 11:10 pm

Message: Sandftw is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
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.
B
6
Posts: 15
Reputation: 277

Post » Wed Jul 22, 2015 11:15 pm

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
B
6
Posts: 15
Reputation: 277

Post » Wed Jul 22, 2015 11:24 pm

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.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Wed Jul 22, 2015 11:33 pm

I found a solution, but I will also try this!
Links aren't showing up because my rep is very low.

Thanks yo!
B
6
Posts: 15
Reputation: 277

Post » Fri Jul 24, 2015 10:10 pm

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.
B
6
Posts: 15
Reputation: 277

Post » Fri Jul 24, 2015 11:42 pm

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.
ImageImage
B
130
S
23
G
7
Posts: 1,078
Reputation: 13,280

Post » Mon Jul 27, 2015 4:48 pm

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.
B
6
Posts: 15
Reputation: 277

Post » Mon Aug 03, 2015 10:57 pm

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
B
6
Posts: 15
Reputation: 277


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 49 guests