Spites

Started by
2 comments, last by little_red_warrior 20 years, 8 months ago
if i am making a nes style game like mario or excitbike, i would use spites, but how do i put them into a game?
«—Ļĩŧŧłę–Ŗęđ–ЩдґґÎðr—»
Advertisement
Hmm might I suggest you start with a console game, if you don''t understand c/c++ then you shouldn''t try this yet make a text game first to imporve your skills then you can start working on that. Anyway to use sprites you probably want to use some kind of API like windows, opengl, or directx but for that you need a good undertanding of c/c++. Once you made a few text games and you have a basic understanding then you should be ready to start using one of those, you can try SDL, or allegro, to make things easier as well.
The monkeys are listening...
Well, sprites are pictures, with a transparency color. A sprie is made of several pictures, and your program must find out, which picture must be displayed.
For example, 3 pictures for walking, 3 pictures for jumping, 2 picures for shooting...

------------------------
- Seby -
www.dfhi-bomber.fr.st
------------------------ - Seby -www.dfhi-bomber.fr.st
Let''s see now.

How much do you know about ''traditional'' animation techniques?

Acrylic cel - the technique Disney used to use - was a way of building up each frame of animation in layers. You''d have sheets of clear plastic, painted with whatever it was you wanted for that layer. So, animators could reuse backdrops (which were expensive) by ''layering'' different characters and stuff on top. A character itself could often be composed of several layers - say you wanted a character to wave, you could just rotate the layers with the sections of his arm on. Alternatively, you could draw out the arm a bunch of times in different positions.

Those are like your sprites. Given a backdrop, you ''overlay'' images - characters (the player or enemies), scenery (like, say, a tree that you want to be drawn on top of the player), powerups, you name it. Each sprite will have a number of different ''frames of animation'' - the second method, ''arm painted in every position'' technique I mentioned earlier - so you pick the frame you want and draw it. In many cases, you''ll have a ''sequence'' of frames - for example, a ''walk'' sequence, which you''ll just loop until the player stops walking.

As for how to get them into the game - you''ll need to load a image file (or files) with all your frames of animation in, maybe extract each individual frame (copy the pixels out to another surface), and then when drawing, decide on a ''transparent'' color (a ''color key''), and don''t draw any pixels which are that color. If your sprite was composed of dark, gloomy colors, you could fill the area around it - which you dont'' want to be drawn - with bright purple, say. That way you can test for that color without worrying that bits of the sprite you *do* want are getting ignored.

Superpig
- saving pigs from untimely fates, and when he''s not doing that, runs The Binary Refinery.
Enginuity1 | Enginuity2 | Enginuity3 | Enginuity4

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

This topic is closed to new replies.

Advertisement