import java.awt.image.*; import java.awt.*; import java.applet.*; public class SpriteImages { private static final byte[] catbytes = { 0,0,0,1,1,0,0,0,0,1,1,0,0,0,2,0,0, 0,0,0,2,2,1,0,0,1,2,2,0,0,0,2,1,0, 0,0,0,1,2,2,2,2,2,2,1,0,0,1,2,2,2, 0,0,0,1,2,2,2,2,2,2,1,0,2,2,2,2,1, 0,0,1,2,2,3,2,2,3,2,2,1,2,2,2,2,2, 0,1,2,2,2,3,2,2,3,2,2,2,1,2,2,2,1, 0,1,2,2,2,2,4,4,2,2,2,2,1,2,2,2,0, 1,2,2,2,2,1,2,2,1,2,2,2,2,2,1,0,0, 1,2,2,2,2,2,2,2,2,2,2,2,2,1,0,0,0, 1,2,2,2,1,1,2,2,1,1,2,2,2,1,0,0,0, 1,2,2,1,2,2,1,1,2,2,1,2,2,1,0,0,0, 0,2,1,1,2,2,1,1,2,2,1,1,2,0,0,0,0 }; private Image cat = null; private static final byte[] dogbytes = { 0,0,0,0,1,0,0,0,1,0,0,0,0, 0,0,0,0,2,1,0,1,2,0,0,0,0, 0,0,0,0,1,2,2,2,1,0,0,0,0, 0,0,0,0,1,2,2,2,1,0,0,0,0, 0,0,0,1,2,2,2,2,1,0,0,0,0, 0,0,1,2,2,3,2,2,1,0,0,0,0, 0,1,2,2,2,2,2,2,1,0,0,0,0, 4,4,2,2,2,2,2,2,1,0,0,0,0, 0,4,2,2,2,2,1,2,1,0,0,0,0, 0,0,1,2,1,1,2,2,1,0,1,0,0, 0,0,0,1,0,2,2,2,1,0,2,1,0, 0,0,0,0,0,1,2,2,1,0,0,2,1, 0,0,0,0,1,2,2,2,2,1,0,2,2, 0,0,0,1,2,2,2,2,2,2,1,2,1, 0,0,0,1,2,1,2,1,2,2,2,1,0, 0,0,1,2,1,2,1,2,1,2,2,1,0, 0,0,1,2,1,2,1,2,1,2,2,1,0, 0,0,1,2,1,2,1,2,1,2,1,1,0, 0,0,1,2,1,2,1,2,1,2,2,1,0, 0,0,0,0,2,2,2,2,2,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1,1,1,1,1,1,1,1,1,1,2, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2, 0,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 }; private Image wall = null; private static final byte[] jewelbytes = { 0,0,0,0,0,0,1,1,1,0,0, 0,0,0,0,0,1,2,2,2,1,0, 0,0,0,0,1,2,1,1,1,2,1, 0,0,0,0,1,1,2,2,2,1,1, 0,0,0,0,0,1,2,2,2,1,0, 0,0,0,0,0,0,1,2,1,0,0, 0,0,0,0,0,0,0,1,0,0,0 }; private Image jewel = null; private static final byte[] doorbytes = { 0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,1,1,2,2,2,1,1,2,2,2,1,1,0,0, 0,1,2,2,2,2,2,1,1,2,2,2,2,2,1,0, 0,1,2,2,2,2,2,1,1,2,2,2,2,2,1,0, 0,1,2,2,2,2,2,1,1,2,2,2,2,2,1,0, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,3,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,3,3,3,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,3,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,2,2,2,2,2,2,1,1,2,2,2,2,2,2,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }; private Image door = null; private static final byte[] exitbytes = { 0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0, 0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0, 1,2,2,2,1,1,1,1,1,1,2,1,1,2,1,1, 1,2,1,1,1,2,1,1,2,1,1,1,1,2,1,1, 1,2,2,2,1,1,2,2,1,1,2,1,2,2,2,1, 1,2,1,1,1,1,2,2,1,1,2,1,1,2,1,1, 1,2,2,2,1,2,1,1,2,1,2,1,1,2,2,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }; private Image exit = null; private static SpriteImages si = null; public SpriteImages( Applet applet ) { ColorModel cm = new IndexColorModel( 8, 5, new byte[] { (byte)0x00, (byte)0x66, (byte)0xCC, (byte)0x00, (byte)0x00 }, new byte[] { (byte)0x00, (byte)0x66, (byte)0xCC, (byte)0xCC, (byte)0x00 }, new byte[] { (byte)0x00, (byte)0x66, (byte)0xCC, (byte)0x00, (byte)0x00 }, 0 ); MemoryImageSource src = new MemoryImageSource( 17, 12, cm, catbytes, 0, 17 ); cat = applet.createImage( src ); cm = new IndexColorModel( 8, 5, new byte[] { (byte)0x00, (byte)0x99, (byte)0x66, (byte)0xFF, (byte)0x00 }, new byte[] { (byte)0x00, (byte)0x00, (byte)0x66, (byte)0x00, (byte)0x00 }, new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }, 0 ); src = new MemoryImageSource( 13, 20, cm, dogbytes, 0, 13 ); dog = applet.createImage( src ); cm = new IndexColorModel( 8, 2, new byte[] { (byte)0xCC, (byte)0xFF }, new byte[] { (byte)0xCC, (byte)0xFF }, new byte[] { (byte)0x00, (byte)0xFF } ); src = new MemoryImageSource( 16, 16, cm, floorbytes, 0, 16 ); floor = applet.createImage( src ); cm = new IndexColorModel( 8, 3, new byte[] { (byte)0xCC, (byte)0x66, (byte)0x00 }, new byte[] { (byte)0xCC, (byte)0x66, (byte)0x00 }, new byte[] { (byte)0xCC, (byte)0x66, (byte)0x00 } ); src = new MemoryImageSource( 16, 16, cm, wallbytes, 0, 16 ); wall = applet.createImage( src ); cm = new IndexColorModel( 8, 3, new byte[] { (byte)0x00, (byte)0x66, (byte)0xCC }, new byte[] { (byte)0x00, (byte)0x00, (byte)0x66 }, new byte[] { (byte)0x00, (byte)0x66, (byte)0xCC }, 0 ); src = new MemoryImageSource( 11, 7, cm, jewelbytes, 0, 11 ); jewel = applet.createImage( src ); cm = new IndexColorModel( 8, 4, new byte[] { (byte)0x00, (byte)0x66, (byte)0x99, (byte)0xFF }, new byte[] { (byte)0x00, (byte)0x99, (byte)0x00, (byte)0xFF }, new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xFF }, 0 ); src = new MemoryImageSource( 16, 16, cm, doorbytes, 0, 16 ); door = applet.createImage( src ); cm = new IndexColorModel( 8, 3, new byte[] { (byte)0x00, (byte)0x00, (byte)0xFF }, new byte[] { (byte)0x00, (byte)0x00, (byte)0xFF }, new byte[] { (byte)0x00, (byte)0x00, (byte)0xFF }, 0 ); src = new MemoryImageSource( 16, 16, cm, exitbytes, 0, 16 ); exit = applet.createImage( src ); si = this; } public Image getCatImage() { return cat; } public Image getDogImage() { return dog; } public Image getFloorImage() { return floor; } public Image getWallImage() { return wall; } public Image getJewelImage() { return jewel; } public Image getDoorImage() { return door; } public Image getExitImage() { return exit; } public static SpriteImages get() { return si; } }