java timer 問題

我寫緊射擊game功課,
個game係敵機全部都係用一個class做出黎ge Object,用timer做郁個effect,但係當敵機create到4部左右,個movement明顯係減慢左,呢個情況個原因係咩呢???
有冇ching知可以用咩方法解決???

thankss

唔夠RAM?

TOP

越多越慢好正常
最簡單改善的方法便是改間隔
其他方法便是優化algorithm

TOP

回復 1# 傳紙仔


how many Timer object did you create?
how many TimerTask object did you create and scheduled to one of the Timer objects?
how much time did you spent on one invocation of the TimerTask instances?

TOP