Author: davedes (posted 2013-01-02 21:40:11, viewed 205 times)
| 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
50
51
52
53
54
55
56
| public static final int[] TABLE = new int[] {
0x0, 0xff1a1a1a, 0xffbfbfbf, 0xffa29446, 0xfff7e26b, 0xffc20000, 0xffff0000, 0xff9d9d9d, 0xff6f4417, 0xffa46422 };
public static final int SPRITE_WIDTH = 11;
public static final int SPRITE_HEIGHT = 9;
public static final int SPRITE_COUNT = 6;
public static final int SPRITE_STRIDE = SPRITE_WIDTH * SPRITE_HEIGHT;
public static final int SPRITE_ARRAY_LEN = SPRITE_STRIDE * SPRITE_COUNT;
public static final int SPRITE_PIRATE1_ATTACK = 0;
public static final int SPRITE_PIRATE1_WALK1 = 1;
public static final int SPRITE_PIRATE1_WALK2 = 2;
public static final int SPRITE_PIRATE2_ATTACK = 3;
public static final int SPRITE_PIRATE2_WALK1 = 4;
public static final int SPRITE_PIRATE2_WALK2 = 5;
public static final BufferedImage SPRITE_SHEET = new BufferedImage(SPRITE_WIDTH, SPRITE_HEIGHT * SPRITE_COUNT, BufferedImage.TYPE_INT_ARGB);
public static final int[] SPRITE_PIXELS = ((DataBufferInt)SPRITE_SHEET.getRaster().getDataBuffer()).getData();
public static final BufferedImage[] SPRITES = new BufferedImage[SPRITE_COUNT];
for (int i=0; i<SPRITE_ARRAY_LEN; i++) {
SPRITE_PIXELS[i] = TABLE["000000000001111212000011111110000034141000000344430000255666502220411171400000888880000008000800000000000000001111212020011111110200034141002000344430200055666540000411171000000888880000008000800000111121202001111111020003414100200034443020005566654000041117100000088888000000888880000008000800000000000000006066600000006666600000634141000000344430000288999802220411171400000888880000008000800000000000000006066600020006666600200634141002000344430200088999840000411171000000888880000008000800000606660002000666660020063414100200034443020008899984000041117100000088888000000888880000008000800000".charAt(i)-48];
if (i%SPRITE_STRIDE == SPRITE_STRIDE-1) {
SPRITES[i/(SPRITE_WIDTH*SPRITE_HEIGHT)] = SPRITE_SHEET.getSubimage(
0, i/(SPRITE_WIDTH*SPRITE_HEIGHT)*SPRITE_HEIGHT,
SPRITE_WIDTH, SPRITE_HEIGHT);
}
}
BufferedImage SPRITE_SHEET = null;
BufferedImage[] SPRITES = new BufferedImage[SPRITE_COUNT];
try {
SPRITE_SHEET = ImageIO.read(new ByteArrayInputStream(DatatypeConverter.parseBase64Binary(
"iVBORw0KGgoAAAANSUhEUgAAAAsAAAA2CAYAAAARSGNVAAAAvUlEQVR42mNgIAVISUn9R8b79++H0wQVI2Ospi+a4vb/+6NssAIYjdMpMMUwDOKjqwE76xADw38Q/o+EQXyYAhgG64BZC8Nz586FOwerM/JdxP+jY5xuRpfEq5hqkYISOYQiBSMm8UUKTsXokYKhEFekYA1nXJGCN5ypHymj4UxxOA9wTvkPzfbIoUFQAzrGqZA2xRcsqJakKMExLDSGRfFFKFIw0jS+SEFRTChSyM9WuCJlMBdfo+E8+IovAE/bY0jTK+k2AAAAAElFTkSuQmCC"
)));
for (int i=0; i<SPRITE_COUNT; i++)
SPRITES[i] = SPRITE_SHEET.getSubimage(0, i*SPRITE_HEIGHT, SPRITE_WIDTH, SPRITE_HEIGHT);
} catch (Exception e) {
} |
Special syntax:
- To highlight a line (yellow background), prefix it with '@@'
- To indicate that a line should be removed (red background), prefix it with '-'
- To indicate that a line should be added (green background), prefix it with '+'
- To post multiple snippets, seperate them by '~~~~'
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|