-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathObject.java
39 lines (31 loc) · 1.1 KB
/
Object.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
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
public class Object extends GameObject{
private BufferedImage sprite;
private ObjectID effect;
//Constructor
public Object(int x, int y, int w, int h, int xdispl, int ydispl, BufferedImage img, ObjectID effect, ID id, Handler handler) {
super(x, y, w, h, xdispl, ydispl, id, handler);
this.effect = effect;
sprite = img;
}
public Object(int x, int y, int w, int h, int xdispl, int ydispl, int ind, BufferedImage img, ObjectID effect, ID id, Handler handler) {
super(x, y, w, h, xdispl, ydispl, ind, id, handler);
this.effect = effect;
sprite = img;
}
public ObjectID getEffect() {
return effect;
}
public void tick() {
if (Game.gameState == State.Game || Game.gameState == State.Tutorial) {
x += Game.objectSpeed;
}
}
public void render(Graphics g) {
g.drawImage(sprite, x + xdispl, y + ydispl, null);
// g.setColor(Color.white);
// g.fillRect(x, y, w, h);
}
}