Objektorientierte Programmierung WS 2013/2014 - Datei PinBall.java
//
// PinBall class. Extends Ball class
//
// From Chapter 7 of
// Understanging Object-Oriented Programming with Java
// Written by Tim Budd
// Published by Addison-Wesley Longman
//
// See ftp://ftp.cs.orst.edu/pub/budd/java/ReadMe.html
// for further information
//
import java.awt.*;
public class PinBall extends Ball {
public PinBall(int sx, int sy) {
super(sx, sy, 10);
// start out moving (roughly) vertical
setMotion(-2 + Math.random() / 4, -18);
}
private double gravityEffect = 0.3;
public void move() {
dy = dy + gravityEffect; // effect of gravity
super.move(); // update the ball position
}
}
Generiert mit Camelot | Probleme mit Camelot? | Geändert am: 14.01.2014


