# How do I make something happen based on a %?

Get help using Construct 2

### » Tue Aug 30, 2016 2:05 am

Let's say I have 60 bunnies on the screen, each colored white.

But then I click a button labeled "May turn a bunny blue". 'May' means could, so there's a chance a bunny could turn blue if I press that button.

How do I say that I want an event to have a 50% chance of occurring?

I'm not sure why all my questions involve bunnies, hopefully I made sense though.
B
30
S
12
G
1
Posts: 167
Reputation: 3,038

### » Tue Aug 30, 2016 2:15 am

if button is clicked AND random(100) < 50 then turn the bunny blue.
or you could do
if button is clicked AND choose (0,1) = 0 then turn the bunny blue.
B
88
S
43
G
71
Posts: 601
Reputation: 43,669

### » Tue Aug 30, 2016 2:49 am

Thanks! I assume you're talking about the Compare Two Values event. The first option works perfectly, thank you.
B
30
S
12
G
1
Posts: 167
Reputation: 3,038

### » Mon Sep 12, 2016 3:11 pm

If I have a button, and I want it to goto a layout 4/5 times, and goto another 1/5 times, how would I go about doing that. Thanks.
B
3
Posts: 2
Reputation: 179

### » Mon Sep 12, 2016 4:01 pm

2 layouts. 1 called "one" & 1 called "two".

Go to (layout) choose("one","one","two","one","one")
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450

### » Tue Sep 13, 2016 3:51 am

Or using #spacedoubt method:
button is clicked
random(100)<80 --> go to layout1
else --> go to layout2
B
29
S
10
G
10
Posts: 97
Reputation: 6,614

### » Tue Sep 13, 2016 9:35 am

AS yet another alternative, you may check this tutorial that deals with the subject.
New to Construct ? Where to start

Please attach a capx to any help request or bug report !
Moderator
B
311
S
128
G
101
Posts: 7,413
Reputation: 75,222