0
我有一個大問題。我需要創建AndEngine的方法,將做以下幾件事:在AndEngine中暫停每個循環的特定時間的線程
- 週期throigh與實體疊加
- 得到使用getmNumber的實體的數量()
- 等待1秒
- 使用它的數使用setVisible()在2個精靈之間進行交換;
- 等待1秒
- 將它們交換回來。
- 將怪物推到另一個堆棧。
問題是數字3和5,當我需要等待每個週期1秒。
我有一個大問題。我需要創建AndEngine的方法,將做以下幾件事:在AndEngine中暫停每個循環的特定時間的線程
問題是數字3和5,當我需要等待每個週期1秒。
可以使用線程:
new Thread(new Runnable() {
public void run() {
/* Do things */
Thread.sleep(1000); /* Wait 1000 milliseconds */
/* Do things */
}
}).start();
如果你需要運行在UI線程的東西,用這個線程內
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
/* This will run on ui thread */
}
});