Best way to animate a sprite?
Page 1 of 18 Replies - 4933 Views - Last Post: 22 April 2011 - 12:16 PM
#1
Best way to animate a sprite?
Posted 15 April 2011 - 06:04 PM
What algorithms do you all use when performing sprite animations?
Replies To: Best way to animate a sprite?
#2
Re: Best way to animate a sprite?
Posted 15 April 2011 - 06:19 PM
an example of such a spritesheet is this: doom spritesheet
That's what I do anyway
#3
Re: Best way to animate a sprite?
Posted 15 April 2011 - 07:26 PM
sk1v3r, on 15 April 2011 - 06:19 PM, said:
an example of such a spritesheet is this: doom spritesheet
That's what I do anyway
I've seen a few people using sprite sheets, interesting, I'll have to look into this.
#4
Re: Best way to animate a sprite?
Posted 22 April 2011 - 08:53 AM
Java Spritesheet Code
The concept is universal to any language really, so I'd focus on understanding the concept. Keep in mind that it does require the sprites to have standard dimensions.
#5
Re: Best way to animate a sprite?
Posted 22 April 2011 - 09:04 AM
Prototypical, on 22 April 2011 - 08:53 AM, said:
Java Spritesheet Code
The concept is universal to any language really, so I'd focus on understanding the concept. Keep in mind that it does require the sprites to have standard dimensions.
I tried that, didn't work out quite as I anticipated, however I'm now using Slick 2D to animate my spritesheets and it's working fantastic!
#6
Re: Best way to animate a sprite?
Posted 22 April 2011 - 10:41 AM
It's basically just grabbing a region from a bitmap and storing as a frame. The math relies on the sprites being uniform.
I would definitely encourage you to understand the concepts involved, cause using code that you don't understand can lead to problems. If you understand the concept, you can apply it in any language.
This post has been edited by Prototypical: 22 April 2011 - 10:45 AM
#7
Re: Best way to animate a sprite?
Posted 22 April 2011 - 11:55 AM
Prototypical, on 22 April 2011 - 10:41 AM, said:
It's basically just grabbing a region from a bitmap and storing as a frame. The math relies on the sprites being uniform.
I would definitely encourage you to understand the concepts involved, cause using code that you don't understand can lead to problems. If you understand the concept, you can apply it in any language.
I get the concept, it's not something that didn't take a little playing around with when I was using the Slick game engine. I don't know if it's standard for every sprite in the game to be on the same sprite sheet, but I simply keep a sprite sheet for each character. I.e., there's a sprite-sheet for a particular character's attack animation. Though if you understand how the spritesheet is structured it's not a difficult feat, all it takes is to play around with the coordinates a little.
This post has been edited by Deviara: 22 April 2011 - 11:56 AM
#8
Re: Best way to animate a sprite?
Posted 22 April 2011 - 12:09 PM
Deviara, on 22 April 2011 - 11:55 AM, said:
Prototypical, on 22 April 2011 - 10:41 AM, said:
It's basically just grabbing a region from a bitmap and storing as a frame. The math relies on the sprites being uniform.
I would definitely encourage you to understand the concepts involved, cause using code that you don't understand can lead to problems. If you understand the concept, you can apply it in any language.
I get the concept, it's not something that didn't take a little playing around with when I was using the Slick game engine. I don't know if it's standard for every sprite in the game to be on the same sprite sheet, but I simply keep a sprite sheet for each character. I.e., there's a sprite-sheet for a particular character's attack animation. Though if you understand how the spritesheet is structured it's not a difficult feat, all it takes is to play around with the coordinates a little.
Yes, for the code that was posted, you should only have character per spritesheet.
There are other ways to do a spritesheet though, where the spritesheet is accompanied by a file that has the coordinates of all the sprites on the sheet.
Zwoptex is a good example : Zwoptext
Zwoptex will allow you to load in images and it will do the dirty work of arranging them on the spritesheet, and it outputs a file with those coordinates. This allows you to load in only 1 spritesheet, instead of multiple smaller ones. Since it also finds the best way to fit them, it can sometimes save you some memory as well.
great tool
This post has been edited by Prototypical: 22 April 2011 - 12:11 PM
#9
Re: Best way to animate a sprite?
Posted 22 April 2011 - 12:16 PM
Prototypical, on 22 April 2011 - 12:09 PM, said:
Deviara, on 22 April 2011 - 11:55 AM, said:
Prototypical, on 22 April 2011 - 10:41 AM, said:
It's basically just grabbing a region from a bitmap and storing as a frame. The math relies on the sprites being uniform.
I would definitely encourage you to understand the concepts involved, cause using code that you don't understand can lead to problems. If you understand the concept, you can apply it in any language.
I get the concept, it's not something that didn't take a little playing around with when I was using the Slick game engine. I don't know if it's standard for every sprite in the game to be on the same sprite sheet, but I simply keep a sprite sheet for each character. I.e., there's a sprite-sheet for a particular character's attack animation. Though if you understand how the spritesheet is structured it's not a difficult feat, all it takes is to play around with the coordinates a little.
Yes, for the code that was posted, you should only have character per spritesheet.
There are other ways to do a spritesheet though, where the spritesheet is accompanied by a file that has the coordinates of all the sprites on the sheet.
Zwoptex is a good example : Zwoptext
Zwoptex will allow you to load in images and it will do the dirty work of arranging them on the spritesheet, and it outputs a file with those coordinates. This allows you to load in only 1 spritesheet, instead of multiple smaller ones. Since it also finds the best way to fit them, it can sometimes save you some memory as well.
great tool
That's neat, that sounds like something I worked with recently. It was an application called Tiled that allows you to generate a tilemap, which in it's simplest form is just an xml file pointing to an image resource somewhere and represents, well, a map of tiles that the user sees on the screen. The cool thing about this is that you can set additional properties for each tile, i.e. I could set a blocked property with a value of true and in code I can load up that tile map as a 2D array of individual tiles and evaluate it's blocked property when I'm doing collision detection really awesome tool.
Anyways, I digress, thanks for the tips fellas.
This post has been edited by Deviara: 22 April 2011 - 12:17 PM
|
|

New Topic/Question
Reply




MultiQuote




|