Timer that changes during the course of the scene

0plus1

  • Posts: 20
Im pretty new to this, but I'm trying to convert a game from corona to stencil.

Currently I have a scene behavior that:

when created
   do every ATTRIBUTE seconds
   create ACTOR at x y

Now, ATTRIBUTE is the current level of the scene (like old arcade games), binding the value in the when created event the value will only be set once, how can I change the timer during the course of the scene?

I hope I explained myself.

Thank you very much for your help.

0plus1

  • Posts: 20
Anybody has any ideas about this?

I don't really know how to do it and I can't find any information about this

Jon

  • *
  • Posts: 17533
If you need to change the timer, you need to cancel the original and reissue it with the modified duration. It's hard to pin down the exact logic since I don't have the full context - someone can help you with the details tomorrow if you have more of those details.

For example, if TASK_LENGTH if a number game attribute.

when this hears spawnTask
{

do every TASK_LENGTH seconds
{
   if(someCondition)
   {
      cancel this task
      set TASK_LENGTH to blah
   }
}

}