@Override public void actionPerformed(ActionEvent arg0) { LevelScreen screen = levelScreenManager.getScreen(); BallShooter shooter = screen.getShooter(); BallSequence sequence = screen.getSequence(); Hole hole = screen.getHole(); sequence.slide(); if (shooter.getShooting()) { shooter.shoot(); Ball current = shooter.getCurrent(); if (sequence.contains(current.getPoint())) { collisionManager.updateSequence(current, sequence); shooter.switchShooting(); } } if (hole.containsBall(sequence)) finishLevel(0); // lost if (sequence.getSize() == 0) finishLevel(1); // won }
public void throwBall() { LevelScreen screen = levelScreenManager.getScreen(); BallShooter shooter = screen.getShooter(); shooter.shoot(); }