Hello everyone.
I’m trying to archive a scheduled behavior not have any delay at the begining. But I mean absolutely 0 seconds delay. Let me explain what i mean.
I tried this approach,
this->schedule(CC_SCHEDULE_SELECTOR(Tower::shoot), 0.3f, CC_REPEAT_FOREVER, 0.f);
Yes this gives me 0 seconds delay at the start as I specified, but because of the 0.3 interval, scheduled behavior still delays 0.3 seconds at the first shot. Sequence goes like this; wait 0.3 seconds, fire the first bullet, then wait another 0.3 seconds, fire another bullet etc.
What I want to do is, ignore that first 0.3 delay as well. I mean when the behavior scheduled, sequence should be like this; shoot the first bullet immediately, wait 0.3 seconds, shoot second bullet, wait 0.3 seconds etc.
Can I accomplish that with built-in scheduler, or I have to implement my own scheduling mechanism at the update method.
Thanks.
Edit: I manage to provide that behavior by manually calling shoot() method for the first time just before I schedule it but it still seems a hack to me, and I’m not sure this approach will be a generic one. I’m still all ears.