-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiniPlatform.java
More file actions
42 lines (33 loc) · 1.02 KB
/
MiniPlatform.java
File metadata and controls
42 lines (33 loc) · 1.02 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
41
42
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
public class MiniPlatform extends GameObject {
Image platform2;
int mapX, mapY;
public MiniPlatform(int x, int y, int mapX, int mapY){
super(0,0,0,0,x, y, null);
this.mapX = mapX;
this.mapY = mapY;
try {
URL url = getClass().getResource("images/platform2.png");
platform2 = ImageIO.read(url);
}
catch (IOException ex) {
// handle exception...
}
this.setBoundingRect(this.getX(), this.getY(), mapX/6, mapY/16);
}
@Override
public void checkOffScreen() {
// TODO Auto-generated method stub
}
@Override
public void draw(Graphics g) {
g.drawImage(platform2, this.getX() , this.getY(), mapX/6, mapY/16, null);
this.setBoundingRect(this.getX(), this.getY(), mapX/4, mapY/16);
//g.drawRect(this.getX(), this.getY(), this.getBoundingRect().width, this.getBoundingRect().height);
}
}