Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Best method for animated sprites?

Author
Message
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 23rd Jul 2009 04:46
Okay i have a TON of sprites that i can use either in GIF format or cut them up into little pieces, should i make sprite sheets or is there some simpler way to do this? (im new to 2d)
thanks,
cmk

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Jul 2009 05:35
It just depends on how you want to work with them. If you want to grab them yourself and not use the CREATE ANIMATED SPRITE command then put them on one sheet, load it up with LOAD BITMAP and grab each image using a FOR/NEXT loop. If you want to use the CREATE ANIMATED SPRITE command you'll have to separate each animation with a drawing program and put it in it's own file.

The one thing you don't want to use is .gif. Use .png instead... pngs allow you to use multiple alpha channels so you can easily have sprites that have semi transparent areas. Like buildings with windows, or ghost characters that you can see through.

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 23rd Jul 2009 06:02
Okay thanks, any good programs that create sprite sheets from animates sprites?

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Jul 2009 07:25
Any drawing program will do. I use Paint Shop Pro 7 for all my graphic work.

Now by "create sprite sheets from animates sprites" do you mean the files you want to use are already .gif animations? If the answer is yes, Paint Shop Pro 7 comes with Animation Shop that allows you to transfer a .gif animation to Paint Shop Pro. What it does is makes each frame another layer in one file so it's easy to copy just whats on the layer and quickly make a sprite sheet. The good news is Animation Shop is free so even if you don't have Paint Shop Pro you can use it to copy each individual frame and paste it into the drawing program you do have. And of course you can make new animations or modify old ones with Animation Shop.

http://ftp.jasc.com/pub/en/ani311en.exe

The attached image is what Animation Shop looks like loading my avatar (a .gif animation).

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Jul 2009 07:26 Edited at: 23rd Jul 2009 07:30
And this is what it looks like after exporting to Paint Shop Pro. That's if you want to copy all frames at once. If you just select one frame and hit copy it'll only copy that one frame to whatever program you want to use.

Attachments

Login to view attachments
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 23rd Jul 2009 07:40
Ah sweet, this raises another question, can you somehow use animated GIF's in your game as sprites and control there frames?

Deego
16
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 23rd Jul 2009 18:24 Edited at: 23rd Jul 2009 18:30
I prefer making my own sprite animation protocols and not using create animated sprite.

I load the frames of an animation like this:



Then I control the animations like so:



I like my system for two reasons: I don't need to create giant grid images for animations, and I can use the same process to animate a 3D plain or surface. I don't know if it's faster than Create Animated Sprite, though.

I'm not sure about the animated GIFs, but seriously, start using PNG for the sweet alpha channel abilities. If you have some animated GIFs, find a program that lets you separate the frames.

EDIT: more reasons to make your own animation protocall: All the sprite functions work with no trouble; mirror, stretch, rotate, and paste your animating sprites. I remember using Create Animated Sprite and needing multiple sets of images to get different sprite scales.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Jul 2009 21:18
Quote: "Ah sweet, this raises another question, can you somehow use animated GIF's in your game as sprites and control there frames?"


When I saw your question I tried to load a .gif and for some reason Darkbasic Pro wouldn't let me load .gifs period (animation or straight image). In the past loading a .gif animation would only show the first frame.

Like Deego I prefer to control the animation myself. What CREATE ANIMATED SPRITE does is make it easier to work with so you don't have to go through all the processes to make an animation work manually. It basically combines all the steps we'd do ourselves in a few commands.

Here's the manual way (using the attached image):



Here's with CREATE ANIMATED SPRITE instead (using that same image):


Both code snips show exactly the same results using the same images animating at the same delay. The only difference is obviously the amount of code needed for the same result.

With the manual method we have to load the sprite sheet, grab the 10 images, change the current bitmap to the main screen, manually change what image the sprite uses to animate, and make our own timer for image changing delay.

With CREATE ANIMATED SPRITE it uses a single command to grab all frames in a single image and it's easy to set which frames to play and the delay to use with the PLAY SPRITE command.

Attachments

Login to view attachments
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 23rd Jul 2009 22:00
Sweet i love it. so when i take all the frames from my gifs or cut up my images how do i know if i spaced them out evenly enough?

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Jul 2009 01:13
Since they usually have transparent backgrounds the easiest way is to put a dot in each corner of the frames. That way when you copy the image you can see where the frame borders are and erase the dots after you're done. Just make sure there are no spaces between the frames and line up the dots right next to the last frames dots. If you're off a bit in alignment your character will wobble or if it's really off scroll to the right (this can happen if you tell Darkbasic the wrong number of frames to grab too).

What Darkbasic does with the CREATE ANIMATED SPRITE command is it takes the size of the image and divides it by how many frames you tell it to grab. The image I used is 511x52. Darkbasic is told with the CREATE ANIMATED SPRITE command that there are 10 frames in a 1x1 grid. So it takes frames that are (511/10) 51 pixels across by (52/1) 52 pixels high. Each frame should be 51x52 pixels.

Of course I forgot to make the size of the image an even number so it'll shift slightly on some frames (because the actual frame size grabbed is 51.1). It would of been better if the image I used was 510x52.

Attachments

Login to view attachments
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 24th Jul 2009 02:27
thanks, i was thinking of finding just reference points, but your idea is much better, how could i do that for sprite sheets? Measure each one? thanks for all your help!

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Jul 2009 03:10
Np.

That's the beauty of using Paint Shop Pro. It has multiple layers that can be turned on or off at will. What I do is make a sprite sheet with the dots in the corners, add a layer and make full boxes to that new layer using the dots as a reference, then delete the dots on the starting layer. What I end up having is a file with the sprite sheets surrounded by boxes to show the alignment. And an easy way to see the x and y to grab those boxes should I want to do the image grabbing manually. It's kinda tricky when you first start doing it that way because the characters are independent of the alignment boxes but you'll get used to it eventually.

I save that sprite sheet as a .psp (Paint Shop Pro format) to save the layer information and alpha channels, then turn off the alignment boxes with the layer visibility toggle, and save it again for use in Darkbasic as a .png. If I'm off in the grabbing at all I can save the .png with the boxes on and see exactly which image(s) are off.

I always add (psp) to any working graphics files so I know which file I'm working on (and not the .png that Darkbasic will load). Saving it as a .psp also allows you to modify the alpha channels any time you want to without having to redo a .png.

Any drawing program that allows multiple layers will do.

Attachments

Login to view attachments
wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 24th Jul 2009 05:21
Ah thanks,
i actually ment turning something like this:
http://images.mslugdb.com/spritesheets/metalhead/3%20armys.html
into an even sprite sheet, well some of them, like do i cut them out to a specific dimension and line them up?

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Jul 2009 22:21
Yeah you'd have to line them up... but you use a box thats big enough to hold the biggest sprite you want to use. Like if you started with the one he's squatting you don't want a box to be around him squatting exactly because in that animation he stands up.

Unfortunately most of the time people that make sprite sheets aren't programmers so we have to realign all the sprites to grab them easily. With a sheet like that you'll have to do the first method you talked about (lining up either the feet or the head and chest area). It's painful on a sheet that big because it'll take days to do it.

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 24th Jul 2009 23:00
I thought so :S i wish they would make that spritesheet lines up because my game would be functioning already!

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 25th Jul 2009 00:46
Yeah. That's one of my wishes too... I'd like to meet one of those guys and teach them how to line up the sprites for programming... or get a tazer to the crotch. That may be a bit harsh though.

wickedly kick it
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: Fort-worth Texas
Posted: 25th Jul 2009 01:03
nah, that guy who made the 3 armies needs to be shot, its like perfect for games!

Login to post a reply

Server time is: 2024-11-24 04:52:17
Your offset time is: 2024-11-24 04:52:17