Change Opacity

Get help using Construct 2

Post » Wed Mar 05, 2014 5:27 pm

Hello all

I'm stuck with this:

I need when player on collision with (A), The layer opacity go up from 0 to 90 (1 every second) , when it reach 90 the player die.

When the above event working, If the player on collision with (B), The opacity stop go up and start go down until it reach 0.

I've created a complex event with global variable but when the player die and the system load the game the event stop working, so i'm searching for better solution.

Thank's for any help
B
7
S
1
Posts: 65
Reputation: 586

Post » Wed Mar 05, 2014 6:20 pm

You might want to post a stripped down .capx of your problem, that way people could take a better look..
B
75
S
28
G
32
Posts: 480
Reputation: 19,711

Post » Wed Mar 05, 2014 6:38 pm

@slanw, would you mind share some code (or psuedo-code)? It may be easier that way to determine what is wrong rather than guessing. And, can you please be more specific on how your game "stops working"? Maybe there was a global/static variable that you didn't reset when the game started?

My first idea for how I would do this is to add an instance variable to player for health. Then, I would put two conditions in the event: 1) On collision, 2) Every 1 second. And then, the actions would change opacity and instance variable value.
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Wed Mar 05, 2014 8:36 pm

Well, it seems it works at first, than you restart the layout and it stops working.

I've created a complex event with global variable but when the player die and the system load the game the event stop working, so i'm searching for better solution.


Maybe your Global Variable is keeping its value between sessions.
Put a "On start of layout" condition and reset the value of that variable, if I understood it right, it might work.
B
37
S
5
G
2
Posts: 46
Reputation: 3,854

Post » Thu Mar 06, 2014 1:08 pm

Thank's all

I know now what's wrong : i'm using save-load system, and my game is long platform game not level game.

So if the player die, he will go back to the last check point and the global variable will not reset.
I need all the global and instance variable and the object's to reset if the player die.

Any help??
B
7
S
1
Posts: 65
Reputation: 586

Post » Thu Mar 06, 2014 2:06 pm

System Action reset all global variables
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 51 guests