开发者

How to detect how many times a selector has been performed Cocos2d?

开发者 https://www.devze.com 2023-03-09 09:51 出处:网络
I have a game in the works in Cocos2d. I have enemies that spawn every 0.8 seconds. I would like to have a DIFFERENT type of enemy s开发者_JAVA技巧pawn after, say, 25 spawn. How do I tell how many tim

I have a game in the works in Cocos2d. I have enemies that spawn every 0.8 seconds. I would like to have a DIFFERENT type of enemy s开发者_JAVA技巧pawn after, say, 25 spawn. How do I tell how many times a selector has been called? Any help is appreciated. Thanks!


so this might be a really simple answer, but I feel I should ask it, can't you just use a counter that you increment on each creation? Is there any reason why you aren't doing this?


I'm totally agree with Mark, but want also to suggest you to create a class Generator, which will be responsible for spawning enemies, will have the counter and any other logic you need to specify which monster you need to create.

0

精彩评论

暂无评论...
验证码 换一张
取 消