How to change TimerHandler delay in AndEngine?

前端 未结 4 1605
余生分开走
余生分开走 2021-01-01 07:49

I have this method i create that adds a sprite to my andengine scene every second.

 private void createSpriteSpawnTimeHandler(){
        TimerHandler spriteT         


        
4条回答
  •  别那么骄傲
    2021-01-01 08:36

    Looking at the TimerHandler source file here: http://code.google.com/p/andengine/source/browse/src/org/anddev/andengine/entity/handler/timer/TimerHandler.java?r=30ba07312ed7d4636077b835ba15f772e3f30db7

    You'll see that there isn't a method to update the interval. And the variable mTimerSeconds is also final.

    I would implement my own IUpdateHandler class and add a non-final mTimerSeconds and a method to update it.

    You can copy the existing TimerHandler and then make the changes accordingly.

提交回复
热议问题