-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPowerUp2.java
More file actions
40 lines (34 loc) · 1.06 KB
/
PowerUp2.java
File metadata and controls
40 lines (34 loc) · 1.06 KB
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
import java.awt.*;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
public class PowerUp2 extends TankObjects {
private Shape blockShape;
BufferedImage block;
public PowerUp2(double x, double y, TankObjectID id) {
super(x, y, id);
theta = Math.toRadians(0);
xxAxis = 32;
yyAxis = 32;
blockShape = new Rectangle2D.Double(x, y, xxAxis, yyAxis);
TankGameImage loader = new TankGameImage();
block = loader.loadImage("resources/mushroom1.png");
}
@Override
public void clock() { }
@Override
public void create(Graphics graphics) {
graphics.drawImage(block, (int)x, (int)y, xxAxis, yyAxis, null);
}
@Override
public void createMini(Graphics graphics, int x, int y) {
graphics.drawImage(block, (int)this.x / 8 + x, (int)this.y / 8 + y, xxAxis / 8, yyAxis / 8, null);
}
@Override
public Shape getShape() {
return blockShape;
}
@Override
public Rectangle getRectangle() {
return new Rectangle((int)x, (int)y, blockWidth, blockHeight);
}
}