final Handler handler = new Handler();
final Runnable timer = new Runnable() {
@Override
public void run() {
// user too late: increment miss counter
if (++secondmisses >= MISS_LIMIT) {
//TODO miss limit reached
finish(); // close this activity
}
}
};
这是我的可运行计时器,不确定是否可以在这里找到解决方案
我想让我的球体在 5 秒内检测到碰撞
如果(在 5 秒内发生碰撞)向上移动,如果他们说没有碰撞,则向下移动
这是我下面的代码
我不确定我还能做些什么
mRobot.drive(0.0f, ROBOT_VELOCITY);
handler.removeCallbacks(timer);
handler.postDelayed(timer, ONE_SECOND);
this.checkcollision(v, 1); // if there is no collision
this.checkcollisoon(v,2); //if there is a collision
请帮忙 :)