| |
Trap
Registered: Jul 2010 Posts: 223 |
Photoshop to Sprite conversion
Hi all,
I am sure this has been asked before, but I haven't been lucky enough to find it. So, I dare ask it....
What's the easiest way to export some graphics from Adobe Photoshop (for example) to a multisprite arrangement that I can paste into KickAss source code. Now, Sprite-Editor 2.01 has some bmp/gif import capability and actually all the functions I need, but the program just doesn't work as intended. I haven't had any luck importing my graphics into it anyway.
So, anybody here who'd care to share the wealth and fill me in on a nice and clean way of achieving this?
Thanks a bunch.
/Trap |
|
| |
Mr. SID
Registered: Jan 2003 Posts: 424 |
You can do that with vicpack (http://code.google.com/p/vicpack/), but it saves sprites as a sequence of 63 bytes chunks, so you might need to add an empty byte after every sprite.
Alternatively, you will find that a Python script to do that particular job can be written in under 100 lines of code.
Having a script that does your conversion automatically means you can add it to your build process and changing the image file will automatically generate new sprites the next time you build your program. |
| |
Shadow Account closed
Registered: Apr 2002 Posts: 355 |
Perhaps you can make use of the built in graphics conversion routines of KickAss?
Look up getSinglecolorByte/getMulticolorByte in the Kick Assembler documentation. |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
If you're Python savvy I have a class for layered, tiled images with color restrictions. Doing a multicolor bitmap with a hires sprite overlay is as "simple" as:
Layer 0: 1 color, 1x1 pixels, 1x1 tiles, aspect 320x200 (i.e. d021)
Layer 1: 3 colors, 4x8 pixels, 40x25 tiles, aspect 2x1
Layer 2: 1 color, 24x21 pixels, 8x10 tiles, aspect 1x1
You can then control the palette for each tile, plot pixels, and read out bitmap data.
It needs a little more work to really be convenient to use, but it can handle pretty much any weird layered format you need... |
| |
SIDWAVE Account closed
Registered: Apr 2002 Posts: 2238 |
There is a C64 plugin for Photoshop. |
| |
enthusi
Registered: May 2004 Posts: 677 |
gimp can export sprites.
Also there IS a python script available in codebase64.org
|
| |
Slammer
Registered: Feb 2004 Posts: 416 |
If your sprites is presents in a gif-file then do the following (The values in the list is the rgb values of the 4 sprite colors).
.pc = $3000 "Sprite Data"
spriteData:
:LoadSpriteFromPicture("sprite1.gif")
:LoadSpriteFromPicture("sprite2.gif")
:LoadSpriteFromPicture("sprite3.gif")
// etc
.macro LoadSpriteFromPicture(filename) {
.var picture = LoadPicture(filename, List().add($000000, $ffffff,$6c6c6c,$959595))
.for (var y=0; y<21; y++)
.for (var x=0; x<3; x++)
.byte picture.getMulticolorByte(x,y)
.byte 0
}
|
| |
Skate
Registered: Jul 2003 Posts: 494 |
here is what i do;
convert a 24x21 black/white image to grayscale and save in raw format. your file should contain 504 bytes containing $00 and $ff only. each byte represents a bit (7th, 6th, ...., 1th, 0th in order). use your favorite programming language to read these 504 bytes in order and group each 8 bytes in a single byte as bits. Here you have your 63 bytes of sprite data. |
| |
SIDWAVE Account closed
Registered: Apr 2002 Posts: 2238 |
I'm guessing, Congo 64 can do many things too. |
| |
Trap
Registered: Jul 2010 Posts: 223 |
Wow. So many options ... I didn't realize there were so many.
I think I'll take a dive into the stuff that is already in KickAss.
Thank you everybody!!!
Trap |
| |
Trap
Registered: Jul 2010 Posts: 223 |
Slammer, I wonder ... is there a way to do a bulk import in KickAss easily? |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
What is Bulk import? Please explain. |
| |
Trap
Registered: Jul 2010 Posts: 223 |
I would like to import a big number of sprites. The code you show me requires me to split all sprites into one file for each sprite and then load each of them individually.
I was wondering if I could load a bigger file with all sprites in it at once.
Not sure I understand this bit by the way: "List().add($000000, $ffffff,$6c6c6c,$959595)" ... you say its the rgb values right? What do you mean exactly? Sorry for being dumb :| |
| |
Slammer
Registered: Feb 2004 Posts: 416 |
The RGB (Red,Green,Blue) value is obtained in photoshop by selecting selecting the pipette tool and then clicking on a color. its 3 8 bit values that tells the intesity of red, green and blue - so $ff0000 is red, $00ff00 is green, $ffffff is white and $000000 is black.
To bulk load alot of sprites from a single picture just insert an extra loop in the macro. |
| |
Cruzer
Registered: Dec 2001 Posts: 1048 |
Here's Slammer's example, adapted for bulk sprite loading, since I just did a similar script myself. It loads a pic with 8 sprites organized horizontally...
.var spriteData = $3000
.pc = spriteData "spriteData"
.var spritePic = LoadPicture("sprites.png", List().add($000000,$ffffff,$6c6c6c,$959595))
.for (var i=0; i<8; i++)
:getSprite(spritePic, i)
.macro getSprite(spritePic, spriteNo) {
.for (var y=0; y<21; y++)
.for (var x=0; x<3; x++)
.byte picture.getMulticolorByte(x + spriteNo * 3, y)
.byte 0
}
|
| |
Frantic
Registered: Mar 2003 Posts: 1648 |
I started a page on codebase related to Kick Assembler macros for various purposes. The two shown in this thread were added there. Feel mighty free to add more, and other kinds, of Kick Assembler macros to that page:
http://codebase64.org/doku.php?id=base:kick_assembler_macros |
| |
Trap
Registered: Jul 2010 Posts: 223 |
Nice! Great to see the 8-bit is alive and healthy!
Thanks everybody! |