Jump to content

time event loop


julilopez
 Share

Recommended Posts

Hello, I have a question. 

 
I add a group to my game, and try to repeat that over a time interval.
 
monkeyObstacle = game.add.group();monkeyObstacle.createMultiple(5, 'monkey_obstacle');this.timerMonkey = this.game.time.events.loop(2000, this.addMonkey, this); addMonkey: function() {    var monkey = monkeyObstacle.getFirstDead();    monkey.reset(1300, 47);    monkey.body.velocity.x = - 200;    monkey.outOfBoundsKill = true; ;}

But not always respect the allocated time interval (2000).

 

Red circles in the selected interval is respected, but the green leaves of respect. 
 
What could be the cause?

 

post-7397-0-24186100-1394662641_thumb.jp

Link to comment
Share on other sites

when I've used timer , sometimes its seems like the fps drops or something and things happen sooner or later than what they should be,   when I set up bullets to shoot at a constant rate every few seconds there would be lag.         It could be that there is only 5 monkeys in the group and they aren't being removed quick enough when out of bounds,   try increasing the amount in the group maybe? and see if that helps

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...