I want to call a method after every 4th game over in my game , but I’m not sure do I use a timer or what would be the best way to implement this ?
The subject line didn’t match your question.
You want a method every x-th game start or do you want a method to be called by a delay?
I use SQLite
or UserDefaults
for this type of thing. I store values in a table and then I read that table on startup. I also then update the table as my game changes while being played.
I want a method to be called by delay, I was just throwing it in there that the method will be called every 4th game over
use a delay action and a lamda
Is there sample code for this in the docs ?
@dimon4eg saves the day once again , so I just call this scheduleOnce code every time I want to call the method ?
Thank you
Yup, is not it easy?
Yup !! Super easy
We do have this code here:
https://docs.cocos2d-x.org/cocos2d-x/en/actions/getting_started.html
and
https://docs.cocos2d-x.org/cocos2d-x/en/actions/basic.html at the bottom.
I’ll add a more concrete example to the docs now.