-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSpawnLevel.java
More file actions
42 lines (33 loc) · 864 Bytes
/
SpawnLevel.java
File metadata and controls
42 lines (33 loc) · 864 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
31
32
33
34
35
36
37
38
39
40
41
42
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.imageio.ImageIO;
public class SpawnLevel extends level
{
private int[] levelPixels;
public SpawnLevel(String path)
{
super(path);
}
protected void loadlevel(String path)
{
try {
BufferedImage image=ImageIO.read(SpawnLevel.class.getResource(path));
int w=width=image.getWidth();
int h=height=image.getHeight();
System.out.println(path);
System.out.println(width +" |"+height);
tiles=new int[w*h];
image.getRGB(0, 0, w, h,tiles, 0, w);
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("LEVEL ERROR");
}
}
// converts level pixles array of integers into array of tiles
protected void generatelevel()
{
}
}