-
Notifications
You must be signed in to change notification settings - Fork 1
/
Square.java
41 lines (34 loc) · 1.07 KB
/
Square.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* CIS 120 Game HW
* (c) University of Pennsylvania
* @version 2.1, Apr 2017
*/
//import java.awt.*;
/**
* A basic game object starting in the upper left corner of the game court. It is displayed as a
* square of a specified color.
*/
/*
public class Square extends GameObj {
public static final int SIZE = 20;
public static final int INIT_POS_X = 0;
public static final int INIT_POS_Y = 0;
public static final int INIT_VEL_X = 0;
public static final int INIT_VEL_Y = 0;
private Color color;
/**
* Note that, because we don't need to do anything special when constructing a Square, we simply
* use the superclass constructor called with the correct parameters.
*/
/*
public Square(int courtWidth, int courtHeight, Color color) {
super(INIT_VEL_X, INIT_VEL_Y, INIT_POS_X, INIT_POS_Y, SIZE, SIZE, courtWidth, courtHeight);
this.color = color;
}
@Override
public void draw(Graphics g) {
g.setColor(this.color);
g.fillRect(this.getPx(), this.getPy(), this.getWidth(), this.getHeight());
}
}
*/