-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTV.java
More file actions
30 lines (24 loc) · 690 Bytes
/
HTV.java
File metadata and controls
30 lines (24 loc) · 690 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
import java.awt.Color;
import java.awt.Graphics;
import java.io.File;
import java.awt.Image;
import javax.imageio.ImageIO;
public class HTV extends Vehicles {
Image myimage;
public HTV(int nx, int ny,int nlane) {
super(nx, ny, nlane);
width = 240;
height = 95;
speed = 1;
try {
myimage = ImageIO.read(new File("truck1.png"));
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void createVehicle(Graphics g) {
// g.setColor(Color.RED);
// g.fillRect(x, y, width, height);
g.drawImage(myimage, x, y, width, height, null);
}
}