IMPORTING SPRITES INTO STUNT ISLAND by Dave Palmowski FIRST THINGS FIRST! WHAT YOU SHOULD HAVE GOTTEN WITH THIS PACKAGE: sprite.txt [this document] pcx2spr.exe [convert pcxs to SI sprites] makespr.exe [makes sprite objects] drawsprt.exe [preview your sprites] palette.pcx [required for drawsprt] si.pal [the SI palette] si.act [the SI palette for Adobe Photoshop] Ok, on with the document! Importing sprites into Stunt Island ("sprite objects") is not exceedingly difficult, it just takes a little bit of RES file juggling. The first thing you're going to have to do is draw your image. To make your image look best, draw it in a high color mode and then convert it to 8bit (256 color mode) and use the palette included with this package. Remember, some colors may come out looking a bit funky (especially if your "time of day" is not high noon), and if you use your sprite in a scene where fading is taking place, some colors won't fade properly. Ok, let's get down to business. I prefer to use Adobe Photoshop for my 2d artwork. It's just so l33t. (But if you don't have it, any paint program that can change color modes and palettes will do.) The first rule of thumb you'll want to remember is that the picture must be square. If you do not make it a square, Stunt Island will make it a square for you, and that usually involves some very ugly stretching. The next thing to remember is (unless I figure out a solution) that the time it takes an animation to play through is constant. Therefore, the more frames you have, the shorter each frame will be visible. For example, if you make a two frame animation, each frame will be visible for about a third of a second. On the other hand, if you make an animation with ten frames, each frame will be on for a much smaller fraction of a second. Keep this in mind when you're drawing. Furthermore, sprites are drawn from the center, so orient your frames accordingly. Each frame must be in a seperate image. Once the frames are drawn, you have to convert them to Stunt Island's format. To do this, you're going to have to convert your frames to PCX format images. It's extremely important that your image is saved in 8bit format (256 colors) and that !(width%2). Sorry, bad programmer's joke there. It means that the width has to be an even number. After you've saved all the frames as PCXs, it's time to do the conversion. Hopefully you can get to a command prompt and use the enclosed program (pcx2spr.exe) for every frame, you'll have to use the following command: pcx2spr (pcxfilename) (sprfilename) (pcxfilename) is the FULL filename of the PCX file--you have to include the extension. (sprfilename) is the filename of the sprite you're creating. I usually just use the same filename as the pcx, but with an extension of ".spr" instead of ".pcx" You're free to name your files however you like, just make sure you remember the name you use! After you've got all your frames converted, you need to put them in a RES file. It's best to put them in a seperate file from all your objects, and it's also a good idea to use the original MAKERES program. To make your RES file, use this template: --- cut here --------------------------------------------------------------------------- settemp c:\temp.tmp new filename.res, number sprname0 bin file0.spr sprname1 bin file1.spr sprname2 bin file2.spr ... sprnamen bin filen.spr --- end file here --------------------------------------------------------------------- (don't worry about the spacing) A little explanation: "filename.res" is the name of the RES file you want to create. Call it what you wish but don't give it the same name as any other RES file. "number" is the index you're going to give to this RES file. Every RES file has an index from 0-255 and no two RESes should have the same index the file included with this package, "indices.txt" will give you a list of numbers that you can use. If you don't feel like looking right now, just use the number 30. Alright. Now, where you see "sprname0" to "sprnamen", is where you name your sprites--this isn't really something that has to be done but I like to do it to maintain continuity. You're pretty free to name them as you please, just don't use spaces, and I like to keep them under eight characters. The second part of each line ("bin filen.spr") tells the program what file to use. The bin part has to stay the same but the *.spr part must be changed to the names of each of your sprite files. Here's an example: Important tip time! Remember the order the frames are in in the list!! --- cut here settemp c:\temp.tmp new mysprite.res, 30 frame0 bin dave0.spr frame1 bin dave1.spr frame2 bin dave2.spr logo bin logo.spr flare bin flare.spr --- end of file Ok, stay with me we're almost done I promise. Now get back to the command prompt and run the normal makeres commandline: makeres new.txt I forgot to mention that new.txt is the file that you put all the stuff above in. You can call it whatever you like. You've got your RES file now; put it in the RES subdirectory of Stunt Island. The hard part is done. Now you need to create the object that will use your sprites. To do this, you'll need the other enclosed program, ("makespr.exe") to finish the job. Just go to the directory that holds makespr.exe and run it. You'll be prompted for a filename. Just name your object--give it an extension of bin if you'd like, it would be best if you did that, since objects are usually given the bin extension. Next, you're asked for the object's scale. The best thing I can suggest here is start at 4000 and go up or down as required. You're then asked for the RES File index -- it should be index you gave to your new RES file earlier and how many frames you want--enter the appropriate number. If your animation is only a static object, just enter 1. For each frame now, you'll have to enter the "sprite index." Here's the tricky part. You'll remember I reccomended you remember the order you had your sprites listed in the text file above. Now when you want to make the animation, for each frame, put the number that cooresponds to the frame on the list that you want. Maybe an example would help. Referring to the list above; you decide your animation will go frame0 frame1 frame2 frame1 frame2 frame1 frame0 So you enter 7 for the number of frames, 30 for the RES file index. Then, when prompted, you enter: This is frame 1 of 7 What is the sprite index? 1 This is frame 2 of 7 What is the sprite index? 2 This is frame 3 of 7 What is the sprite index? 3 This is frame 4 of 7 What is the sprite index? 2 This is frame 5 of 7 What is the sprite index? 3 This is frame 6 of 7 What is the sprite index? 2 This is frame 7 of 7 What is the sprite index? 1 If you wanted to make a static animation of just "logo" you would do: This is frame 1 of 1 What is the sprite index? 4 Does it make sense now? Just number in your head (or on paper or in another file) the list of the sprites at the bottom of the text file you made. Ok, now you're done! Now all you have to do is put the .bin file into your custom object RES file just like any other custom object you might have made. Remember, it doesn't go in the one you made at the beginning of this document, it goes into the one where you put all your custom props. Whenever you want to add another sprite, just add the frames to the end of the RES file you created earlier. As long as you don't change any of the ones that are there already, all your existing sprites will work fine. There! You've created your first sprite object. I told you it wasn't so hard :) If you need help, drop me a line at tiberiumdragon@home.com Good luck and happy spriting! -Dave Palmowski President of SIFA 1:09 AM 3/26/01