Archived

This topic is now archived and is closed to further replies.

Tiso

Compiled Sprite

Recommended Posts

I was told that you can insert an image into a C program by using something called a compiled sprite. I haven''t gotten anywhere near Direct X yet, and I don''t plan on using it any time soon, at least not until I finish learning C. If anybody knows how to utilize a compiled sprite or knows of a tutorial I can use please let me know. Any help is appreciated, thanks! ............ Guardian Angel Interactive

Share this post


Link to post
Share on other sites
Tiso

Compiled sprites are simple ways of holding a sprite image within a program, in C you could do this:

unsigned char my_sprite[8][8] = {(0,0,0,0,0,0,0,0),(0,0,1,1,0,0,1,1),(0,0,0,1,1,1,1,1),(0,0,0,1,1,1,1,1),(0,0,0,0,1,1,1,1),(1,1,1,1,0,0,0,0),(0,0,0,0,0,0,0,0),(1,1,1,1,0,0,0,0)};

Now you''ve got a simple array that holds the colour information of an 8x8 pixel sprite.

What you do with it is up to you!

Cheers

Matt



Check out my project at:www.btinternet.com/~Matthew.Bennett

Share this post


Link to post
Share on other sites
Okay thanks! But how do I display it? What do I do with it from there? How do I add my own image? Can I make it bigger? These are a few of the million questions spinning around in my head.

Oh, are there any special #includes I need?

............
Guardian Angel Interactive

Edited by - Tiso on June 19, 2000 9:01:20 PM

Share this post


Link to post
Share on other sites
Sure.. you could probably make 'em any size you wanted, but try to keep them in multiples of two (8,16,32,64 etc)



Edited by - BigBlueMonkey on June 19, 2000 9:09:28 PM

Share this post


Link to post
Share on other sites
Theres a really good article on this site, which has a function to convert any sprite into an asm or C function, I think that should answer all your questions. Even in DX compiled sprites have there use, in my game it''s far more effecient to use compiled sprite''s rather than the blitter for the player bullets because their only 4*4 pixels big. Anyway hope that helps.

Share this post


Link to post
Share on other sites
Hey uh, jeffakew. Do you know where that article is on gamedev? I''ll be looking soon, but just incase I can''t find it, you know.

Thanks everyone!

About displaying it though.....

............
Guardian Angel Interactive

Share this post


Link to post
Share on other sites
There''s also an article on compiled sprites at www.xgames3d.com, it''s probably the same one you guys are talking about. Well, Peace out.

If you build a better mousetrap, the world will beat a path to your doorway...
Then the government takes most of your profits away in taxes. So much for hard work and ingenuity :(

Share this post


Link to post
Share on other sites