/** * Figures the lander state (x, y, fuel, ...) based on the passage of realtime. Does not * invalidate(). Called at the start of draw(). Detects the end-of-game and sets the UI to the * next state. */ private void updatePhysics(long timer) { timer = (long) (timer); // adjust the overall speed // Log.i("update", "fisicacaaa"); tank.update(timer); FunctionalBullet b; int i = 0; while (!bullets.isEmpty() && bullets.size() > i) { b = bullets.get(i); if (b.isOver()) bullets.remove(i); else { b.update(timer); i++; } } FunctionalAircraft a; i = 0; while (!aircrafts.isEmpty() && aircrafts.size() > i) { a = aircrafts.get(i); if (a.isOver()) aircrafts.remove(i); else { a.update(timer); //// int j = 0; while (j < bullets.size()) { b = bullets.get(j); if (a.isFlying() && b.isFlying()) if (a.impactDetected(b)) { hud.addImpact(); a.setImpact(); b.setImpact(); aircrafts.add(new FunctionalAircraft()); // Vibrate for 300 milliseconds vibrator.vibrate(100); } j++; } i++; } } newaircraftimer += timer; if (newaircraftimer > 3000) { aircrafts.add(new FunctionalAircraft()); newaircraftimer = 0; } // hud.update(timer); }