java - Why is one TimerTask slowing down another? -


i have got timer task, updates player positions:

public void run(){     {updatewatcher = new timertask() {         public void run() {             update(0.1);         }     };      t.scheduleatfixedrate(updatewatcher, 5, 5);} 

and have timertask right under one, updates projectile positions:

updatewatcher = new timertask() { //different variable. note capital u.         public void run() {             (bullet b : bullets){                 b.update();             }         }     };     t.scheduleatfixedrate(updatewatcher, 5, 5); } 

however, second timertask slowing down first one. if delete iteration, this:

updatewatcher = new timertask() {         public void run() {          }     };     t.scheduleatfixedrate(updatewatcher, 5, 5); } 

the player moves @ correct speed. however, re-add code (using eclipse de-bugging add live), delayed task executes lot less often, causing players moving more 10 times slower usual.

what causing this, , how fix it?


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -