-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.java
54 lines (42 loc) · 884 Bytes
/
Player.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
42
43
44
45
46
47
48
49
50
51
52
53
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package pong;
import java.awt.Color;
import java.awt.Graphics;
/**
*
* @author Max
*/
public class Player {
private int y = Pong.WINDOW_HEIGHT / 2;
private int y1 = Pong.WINDOW_HEIGHT / 2;
private int yVelocity = 0;
private int width = 10;
private int height = 40;
public Player() {
}
public void update() {
y= y + yVelocity;
}
public void paint(Graphics g) {
g.setColor(Color.green);
g.fillRect(35, y, width, height);
}
public void setYVelocity(int speed) {
y = speed;
}
public int getX() {
return 35;
}
public int getY() {
return y;
}
public int getWidth() {
return width;
}
public int getHeight() {
return height;
}
}