How do I: Make Global variable change it's state.

Get help using Construct 2

Post » Wed Dec 07, 2016 8:36 pm

Good evening pals. Im having a problem in my character selection.

I have two playable characters in game and a Global variable "ActiveCharacter" where i have determined 1 as first character and 2 as second one.

Here's the event sheet and gif from what happens. So basically it works with mouse but with gamepad it doesn't change from 1 to 2. But if i active the character two with mouse it lets me change back to character one with gamepad. :?

Event sheet.
Image
Gif.
Image

I remember having similiar problem before but couldnt find the .capx or solution anymore. :(
Find my devblog @ http://relitgames.com/
B
7
S
2
Posts: 32
Reputation: 587

Post » Wed Dec 07, 2016 10:45 pm

Let me give you an example why this doesn't work.
Let's go event by event.
  1. You start with ActiveCharacter=1 and ActiveScreen=2
  2. You press left on the Gamepad
  3. Line 6 triggers and sets ActiveCharacter to 2
  4. In the same tick, the event in line 9 triggers since ActiveCharacter is now 2 and sets it back to 1
To you, this looks like nothing happened.

The mouse events work since there can only be one mouse event happening at the same time.

What you need to do, is replace ActiveCharacter=2 in line 8 with "Else".
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Thu Dec 08, 2016 2:42 pm

randomly wrote:Let me give you an example why this doesn't work.
Let's go event by event.
  1. You start with ActiveCharacter=1 and ActiveScreen=2
  2. You press left on the Gamepad
  3. Line 6 triggers and sets ActiveCharacter to 2
  4. In the same tick, the event in line 9 triggers since ActiveCharacter is now 2 and sets it back to 1
To you, this looks like nothing happened.

The mouse events work since there can only be one mouse event happening at the same time.

What you need to do, is replace ActiveCharacter=2 in line 8 with "Else".

Yup. That did it! Thanks alot mate. I found the one .capx where i had this similar problem and the Else-condition did it. :)
Find my devblog @ http://relitgames.com/
B
7
S
2
Posts: 32
Reputation: 587


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu and 6 guests