If 3 clicks in 0.5 seconds - bonus

wolf2013

  • Posts: 70
Hi,
I've tried to figure it out by myself , did not work :/

how to count 3 clicks in 0.5 seconds - the idea is to give extra bonus score

thanks

mebloo

  • Posts: 128
You could have an attribute that keeps the click counter and another one that keeps the last click time. When that time is greather than 0.5 seconds, you reset the counter and if it gets to 3, you give your extra bonus score ? Something like that.

t4u

  • Posts: 418
Your question is not precise possible designs:
1. You get title saying  "now click for bonus!" and if you click 3 tiems during  0.5 secondsyou get bonus
2. Every click can be a begining of sequence


Side question
if click sequence like this #0 0.1 #1 0.2 #2 0.3 #3 0.4 Do I get two bonuses?
---------------------------

See if it works

(Option 1)

When created
bool_1 = false // Are 3 seconds being counted

Mouse pressed
 if  not <bool_1>  {
     bool_1 = true
    clcik_counter = 1
    do after 3 seconds
      {  bool_1 = false
          if click_counter>=3 { bonus  } 
      }
}
else { click_counter++}
----------------------------------
Option 2

When created
Click_counter=0
t_1 =0
t_2 =0
t_3 =0

When mosue pressed
if (click_counter<1)
   { if (click_counter==0 ) t1 = time// current time since beginign of the scene
     if (click_counter==1) t2 = time // current time since beginign of the scene
     
   click_counter++
   }
else
{
 t3= time
if (t3-t1<0.5) {bonus}
t1=t2 
t2=t3
 

}

}
USE PICTURES WHEN YOU ASK SOMETHING!
If I helped you be sure to mention it in your game.

Tutorials + downloads:
http://t4upl.blogspot.com/

wolf2013

  • Posts: 70
thanks t4u
I used your option 1, and it works perfectly,  so cool man!


Your question is not precise possible designs:
1. You get title saying  "now click for bonus!" and if you click 3 tiems during  0.5 secondsyou get bonus
2. Every click can be a begining of sequence


Side question
if click sequence like this #0 0.1 #1 0.2 #2 0.3 #3 0.4 Do I get two bonuses?
---------------------------

See if it works

(Option 1)

When created
bool_1 = false // Are 3 seconds being counted

Mouse pressed
 if  not <bool_1>  {
     bool_1 = true
    clcik_counter = 1
    do after 3 seconds
      {  bool_1 = false
          if click_counter>=3 { bonus  } 
      }
}
else { click_counter++}
----------------------------------
Option 2

When created
Click_counter=0
t_1 =0
t_2 =0
t_3 =0

When mosue pressed
if (click_counter<1)
   { if (click_counter==0 ) t1 = time// current time since beginign of the scene
     if (click_counter==1) t2 = time // current time since beginign of the scene
     
   click_counter++
   }
else
{
 t3= time
if (t3-t1<0.5) {bonus}
t1=t2 
t2=t3
 

}

}