New answers tagged


The easiest way is to use counters. If you want your bots to do something in X frames, you'll have: class Bot { constructor() { this.doSomethingCounter = 0; } doSomethingInFrames(n) { this.doSomethingCounter = n; } update() { if (this.doSomethingCounter > 0) { this.doSomethingCounter--; if (this.doSomethingCounter === ...


I found out that objects can be killed with body.lifespan Adding the line bullet.lifespan = 1000; in my fire() function fixed the problem


Not sure i (bother to :-)) understand your code, but i'd like to point out that accumulated time will never be accurate on the long term. If it is crucial that you have consumed exactly 2500 frames in 100 seconds, you likely cannot rely on exact sum of the individual frames. Instead you must make it "absolute". If you require 25 ms per frame, you know for ...


I have a similar problem with jerky frames using android GL 2.0. When traced on android studio GL profiler I saw that the glcompileshader function is called multiple times during game play. This is an expensive call but accounts for the jerkiness. What causes these multiple calls to glcompilershader? I can only guess happens because the shader is invalid ...

Top 50 recent answers are included