-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlant.java
More file actions
49 lines (44 loc) · 1.07 KB
/
Copy pathPlant.java
File metadata and controls
49 lines (44 loc) · 1.07 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
43
44
45
46
47
48
49
import java.awt.image.BufferedImage;
import java.awt.Graphics;
/**
* Creates a plant object. All plant objects are noncollidable
*
* @Jonathan Ke
* @ 8/13/2019
*/
public class Plant
{
//x and y are coordinates of where object is drawn NOT where it will be located
//as an object
private int x;
private int y;
private BufferedImage b;
//Constructors
public Plant(int x, int y, BufferedImage img){
this.x = x;
this.y = y;
b = img;
}
//Constructor for doubling input image onto final plant object
public Plant(int x, int y, BufferedImage img, boolean bool){
this.x = x;
this.y = y;
b = new BufferedImage(64,32,BufferedImage.TYPE_INT_ARGB);
Graphics g = b.getGraphics();
if (bool){
g.drawImage(img,0,0,null);
}
g.drawImage(img,16,0,null);
g.dispose();
}
//accesors
public int getX(){
return x;
}
public int getY(){
return y;
}
public BufferedImage getImage(){
return b;
}
}