-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
43 lines (40 loc) · 908 Bytes
/
Player.java
File metadata and controls
43 lines (40 loc) · 908 Bytes
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
import javax.swing.*;
import java.awt.*;
public class Player {
private int myX;
private int myY;
private int myCurrentHealth;
private ImageIcon sprite;
public Player() {
sprite = new ImageIcon("Sprites/Player.png");
myCurrentHealth = 150;
myX = 175;
myY = 400;
}
public int getX() {
return myX;
}
public int getY() {
return myY;
}
public int getCurrentHealth() {
return myCurrentHealth;
}
public Image getSprite() {
return sprite.getImage();
}
public void setX(int x) {
myX = x;
}
public void setY(int y) {
myY = y;
}
public void setCurrentHealth(int hp) {
myCurrentHealth = hp;
}
public void draw(Graphics myBuffer) {
myBuffer.drawImage(getSprite(), getX(), getY(), 50, 50, null);
}
public void attack() {
}
}