Character Selection Screen

0 favourites
  • 3 posts
From the Asset Store
Selection frame like in RTS games, works both on mobile and desktop devices.
  • 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:

    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!

  • 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 :)

  • Try Construct 3

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

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

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