import Myro.*; public class Game { private MyroCanvas myCanvas; private static final int startXLocation = 50; private static final int startYLocation = 50; private static final int canvasX = 500; private static final int canvasY = 500; public Game() { myCanvas = new MyroCanvas("My Game", canvasX, canvasY); myCanvas.setVisible(true); Cannon myCannon = new Cannon(myCanvas, startXLocation, startYLocation); Ball myBall; while (!MyroListener.isKeyPressed()) { int r = MyroUtils.randomInt(0, 255); int g = MyroUtils.randomInt(0, 255); int b = MyroUtils.randomInt(0, 255); double xVelocity = MyroUtils.randomDouble() * .90 + 15.0; double yVelocity = -(MyroUtils.randomDouble() * .90 + 11.0); myCannon.setAngle((int)xVelocity, (int)yVelocity); myBall = new Ball(myCanvas, canvasX, canvasY, r, g, b, startXLocation, startYLocation); myBall.animate(xVelocity, yVelocity); } } }