Disabling controls and time

chongyunxiang

  • Posts: 216
Hi,

I got my controls and countdown timer working. It's just that I can't make my timer stop at 0. It keeps going to -1 and so forth.

And I'm trying to disable all controls after the timer hits 0. So far the only way I could make everything stop is with the Pause function, but that is definitely not the solution to my problem!

I saw a Timer behaviour, it could make my time stop at 0, but it always shows 4 digits, inclusive of milliseconds. It's a really good timer, but I can't get it to just show 1 single digit. Thus I thought it would be better to just make my own timer, which ended up going into negative time!

Thanks!

Exportforce

  • *
  • Posts: 90
Try if (timer)<=0 -> do stuff. So as soon as you hit 0 stuff happens what ever you want to do.

RengadeQuarters

  • Posts: 98
Here you go try this timer 

chongyunxiang

  • Posts: 216
Try if (timer)<=0 -> do stuff. So as soon as you hit 0 stuff happens what ever you want to do.

I tried, but it still doesn't work, but I'll try it again.  I can make stuff happens when the timer is <=0, but how do I make it stop counting? And what are the commands to disable controls like Right and Left buttons?

Here you go try this timer 

I downloaded it, but it's an image of a hammer! Haha!

RengadeQuarters

  • Posts: 98
 Drag it over to stencyl  were says click here to create a new behavior
it goes in the scene behaviors

chongyunxiang

  • Posts: 216
Drag it over to stencyl  were says click here to create a new behavior
it goes in the scene behaviors

Thanks! It really works! And I studied it and realised that all I need to add or change in mine was just If Timer < 0, set Timer to 0. How stupid of me not to think of that! I kept trying to use = 0 instead of < 0.

I tried creating Left and Right behaviours, then disabling the behaviours on scene when Timer < 0. But when I do that, the behaviours are immediately disabled when scene is created. Where did I go wrong?

Are there any ways I can disable controls when Timer = 0?

« Last Edit: July 17, 2015, 09:51:33 am by chongyunxiang »