Sign in to follow this  

what is a sprite and when do we use it?

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

elo ppl. You must have guessed that i'm new and keen to learn everything about game programming./ Well, can anyone give me a clear definition of a sprite and when to use it? thank you a lot.

Share this post


Link to post
Share on other sites
I hereby introduce... google :)
Just searched for: game programming "what are sprites"
...first hit was http://nondot.org/sabre/graphpro/sprite1.html

Share this post


Link to post
Share on other sites
A sprite is an encapsulated 2D image that gets drawn to the screen/window at a specific position. The sprite's exact image may itself change (be animated), and its position may vary (motion) yielding an animated character that moves around the screen either autonomously (background effects, enemies, etc) or based on user input (avatar, the Hero, etc).

Game Dictionary: sprite.

Share this post


Link to post
Share on other sites
A sprite is usually a 2D (has a width and a height but no depth) image whose main function is to be some kind of 'actor' or 'prop' in an animated scene or game.

For the best example of sprites, look at older console games like Super Mario Bros and Sonic the Hedgehog: the Mario character was a sprite.

In a bit more detail, Mario was a series of sprites used together to make animations - e.g. the animation of him running was done with 2 sprites alternating.

Sprites are often used with tiles in 2D games. Tiles are basically just sprites but are used for more static background stuff, e.g. the bricks, question mark blocks etc. in Mario.

More advanced topics for sprites include things like rotation, scaling, transparency and the role of sprites in today's games such as imposters & bill boards - 2D 'sprites' drawn as textures on polygons in 3D games.

Share this post


Link to post
Share on other sites
so if i did get u right, a sprite is a pixel which you can display on your screen to simulate objects!! And you can specify its color and play around with it to give a good visual aspect. Am i right?

Share this post


Link to post
Share on other sites
Quote:
Original post by baraka
so if i did get u right, a sprite is a pixel which you can display on your screen to simulate objects!! And you can specify its color and play around with it to give a good visual aspect. Am i right?


Nope. A sprite is a 2D image. Usually in a size range of 2-to-the-power-of-something, so 8x8, 16x16, 32x32, 64x64 and so on.
They are used to represent objects in a game world.
For example, as stated above, the Mario character was a sprite - a little picture that could be moved around the screen. The exact picture used depended on his actions - was he moving left, right, or was he jumping? A different sprite would be picked to show his action, and then draw to the screen at his coordinates.

Share this post


Link to post
Share on other sites
A pixel (short for 'picture element') is a single point on your screen. When your computer is running at "800 x 600" resolution, that means the screen is made up of a huge grid that's 800 pixels wide and 600 tall.

A sprite is made up of pixels, and if you really wanted, you could have a sprite that was just one pixel in size...but generally you wouldn't. The whole point of sprites is so you can 'collect' sets of pixel data into single units and then draw them when and where you want.

Share this post


Link to post
Share on other sites
Quote:
Original post by rherm23
i just started in sprites and i was wondering where do i create them. in paint? do i need a certain program?


Anything you like! Paint, Paintshop, Photoshop, it doesn't matter. It's just a bunch of bytes in a file which, together, create a image on the screen because your eyes blend the pixels together...
The only thing you have to worry about later on, is how to load them into your game, but that's so hard with most file formats...

Share this post


Link to post
Share on other sites
<quote>The only thing you have to worry about later on, is how to load them into your game, but that's so hard with most file formats...</quote>

Anyway, i think most of the previous 8-bit and 16-bit games used file format sprites. Maybe that was the only way to generate good graphics at that time instead of using simple pixels. Examples are games like Tecmo NBA and Pac Man.

Share this post


Link to post
Share on other sites
Quote:
Original post by baraka
<quote>The only thing you have to worry about later on, is how to load them into your game, but that's so hard with most file formats...</quote>

Anyway, i think most of the previous 8-bit and 16-bit games used file format sprites. Maybe that was the only way to generate good graphics at that time instead of using simple pixels. Examples are games like Tecmo NBA and Pac Man.

Share this post


Link to post
Share on other sites

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this