Character Selection Screen

Get help using Construct 2

Post » Wed Jun 06, 2012 5:34 am

Hello Guys,

I'm new on Construct2, this is what I'm trying to do:

I have three sprites, which should be a character selection screen.

This is my event sheet:

http://imageshack.us/photo/my-images/402/eventsheetq.jpg/

As you can see, I have two sprites Sprite7 and sprite9 which are the portrait.
The variable whoischoosing, is indicating the player that is choosing the character (player 1 or player 2).

This is why there are two events for each sprite, one if the character is selected for the first player other if is selected for the second player.
The value for whoischoosing when is 3 indicate that the two players choosed the character so is required a layout change.

The problem, is when an user click on a sprite, immediately change to the next layout. Does not give the opportunity to the second player.

- For what I understood - When the user click on a player a the value for whoischoosing changed, immediately call the next event without delay.

So, Is there a way to do this? What is wrong with my event sheet?
Any idea, clarification, correction, etc.. is appreciated.

Thanks in advance!


Image
Image
B
26
S
2
G
1
Posts: 71
Reputation: 2,662

Post » Wed Jun 06, 2012 8:36 am

What's happening, is that when a sprite is clicked, the system goes, ok whoischoosing = 1, and a sprite was clicked, so now we set whoischoosing = 2. But what the system does RIGHT after that is, oh, the sprite was clicked, and now whoischoosing = 2, so now we set whoischoosing = 3. So then right after that it sees that whoischoosing = 3 and goes to the next layout. That's why it does it all in one click, because every condition you have leads it to the next condition in the code. There are many ways to do it, but the way I would do would be something like:

whoischoosing = 3: go to layout 1

whoischoosing = 2
--sprite1 is clicked: set player2 to sprite1
----------------------set whoischoosing to 3
--sprite2 is clicked: set player2 to sprite2
----------------------set whoischoosing to 3

whoischoosing = 1
--sprite1 is clicked: set player1 to sprite1
----------------------set whoischoosing to 2
--sprite2 is clicked: set player1 to sprite2
----------------------set whoischoosing to 2

...by doing it this way, the system has to check to make sure that whoischoosing doesn't = 2 or 3 before it checks anything else. Because whoischoosing = 1 events are at the bottom, the system has to run a new tick before it can check the whoischoosing = 2 events, and the same goes for whoischoosing = 3.

I hope this helps and wasn't too long winded or hard to understand, if it was, please feel free to PM me and I can try to explain it more clearly :)
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Post » Thu Jun 07, 2012 1:03 am

Hello Brent,

Thanks for your help.

I have tested and until is working.
So, for future events, I have to assume that the event sheet is secuential is checking event by event.

Thanks again!

:D
Image
Image
B
26
S
2
G
1
Posts: 71
Reputation: 2,662


Return to How do I....?

Who is online

Users browsing this forum: Walessio, WhosWho and 16 guests