[SDL] Quick Question about animation.
Lamonte(Scheols/Demonic)
scheols at gmail.com
Wed Mar 7 15:17:13 PST 2007
I'm not sure if this is the best way to go, but I think this might
work anyone agree disagree?
void int manOne(){
return 2;
}
void int manTwo(){
return 3;
}
void int spriteRUN(){
if(manOne() == 2){
//call sprite
//change sprite possition
manTwo();
}else if(manTwo == 3){
//call sprite
//change sprite possition
manOne();
}
}
On 3/7/07, Scott Harper <lareon at comcast.net> wrote:
>
> On Mar 7, 2007, at 3:33 PM, Lamonte(Scheols/Demonic) wrote:
>
> > Hello,
> > I was wondering whats the best way to switch between 2 image frames
> > every time I would press a key. For example, If I loaded 2 bitmaps
> > one will have its foot back and the other would have its foot forward
> > so if I would to keep running the frames back and forth it would look
> > like my sprite was walking. Any suggestions on the BEST way to do
> > this?
>
> Unfortunately (as I'm sure many have discovered and I am currently
> discovering), there's no "best" way to do something like this. You
> could set a variable and draw one or the other image based on that
> variable's value (meaning one more if() statement each frame), or you
> could set some pointer variable to a drawing structure to point to a
> different image each time it needs to switch... Those are the only
> two reasonable ones I can come up with. The others a far more
> obscure and unlikely.
>
> Do either of those help at all?
>
> I think a lot of "best" depends on how you're structuring your
> entities, also.
>
> -- Scott
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
--
Join phpdiscovery.com Now!
More information about the SDL
mailing list