Make buttons randomly lighten

Get help using Construct 2

Post » Fri Feb 07, 2014 7:47 pm

Hello dudes,

After lots of tutorials i decided to get a try with Construct 2.
I wanted to make a simple kinda platform/puzzle game and i have a problem.

In my game you need to pop bubbles of precise color.
If you do so you have points and if you don't you lose them.
The color is indicated by 4 indicators that are set invisible in the beginning.

The thing is that i can't find a way to make them become "visible" one by one and randomly without lightening all of them.

Can you help me?
B
13
S
4
G
1
Posts: 241
Reputation: 1,724

Post » Fri Feb 07, 2014 8:40 pm

Would this work?

every x seconds
-pick all buttons - set invisible
-pick random button instance - set visible

I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Feb 07, 2014 10:13 pm

I've already tried but the problem is that for instance easch 3 seconds multiple lights will lighten.
I need just one by one, randomly.
I'm sure there's a very stupid trick but still.. Can't find it
B
13
S
4
G
1
Posts: 241
Reputation: 1,724

Post » Fri Feb 07, 2014 10:15 pm

I need something like. When one is visible the others are invisible. But still this one must be random and alone
B
13
S
4
G
1
Posts: 241
Reputation: 1,724

Post » Fri Feb 07, 2014 10:18 pm

Did you use the system pick random instance as I suggested?
That should only pick one.

You could also use a choose() expression setting a variable and set the light depending on the variable.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Feb 08, 2014 12:25 am

Yep i have tried. But still the same issue.

I will try to be more clear.
I have 4 objects, thus 4 knobs(red, blue, green, yellow) that are initially set invisible.

The idea is that each 3 to 6 seconds one of them will become visible for about 3 seconds and then another one will randomly do the same.

But when I write 4 conditions "-pick random button instance - set visible" for each of them they shine all at the same time.

I even tried to put an or between the 4 conditions, same result.

And then there is another issue, i would like to turn them down after maximum 3 seconds of activity. So i've made a sub event and put 2 conditions in it (if button visible, compare time >3 seconds---->set invisible)...now it's all black lol

There must be a thing i don't get, it's very frustratingvagaev2014-02-08 00:27:05
B
13
S
4
G
1
Posts: 241
Reputation: 1,724

Post » Sat Feb 08, 2014 12:53 am

Here's a solution.

Create one button and then add an animation frame for each colour you want the button to display.
Set ani speed to 0

On your layout you can then manually select the frame corresponding to the colour you want to display.

I've already made it sound more complicated than it is.

Here's a pic showing the important stuff.
I've set it to change every second, change that to 3,6 whatever you want for a slower rate of change.

Ref your second point for effect you could add the "Fade" behaviour to the button and set it to fade out and destroy after the timeout period of your choice. More aesthetic way of presenting the game.

There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Sat Feb 08, 2014 12:55 am

Sorry the img was resized.

There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Sat Feb 08, 2014 1:02 am

Here's how to set the "fade", you will need to add the fade behaviour to the button first.

This example means the button will fade in over 1 second, stay 100% opaque for 2 secs then fade out and destroy over 1 second = 4 seconds total.

So if you changed the 1 sec to 6 secs in my first example you would get 4 seconds to press the button before it disappeared then a two second pause before the next one fades in.

(More than Simon gave you)
There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Post » Sat Feb 08, 2014 1:03 am

Doh!!

There are 10 types of people in the World, those that understand binary and those who don't.
B
7
S
2
Posts: 93
Reputation: 797

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests