Hi:
Assume that there is a bitmap which contains all the attitudes of a creature,and I load each attitude in each frame and wanna play the animation,the problem is that how can I play the selected frames?for instance,like walking.
Hi:
Assume that there is a bitmap which contains all the attitudes of a creature,and I load each attitude in each frame and wanna play the animation,the problem is that how can I play the selected frames?for instance,like walking.
Hmm, i dont know a direct answer to you question, but i would suggest putting your frames into an animation. Then refer to Ken Fitlikes tutorial, its neat ken!. He shows you how to display an animation in one of his tutorials.
http://www.foosyerdoos.fsnet.co.uk/
Hope that helps
TNT
TNT
You Can Stop Me, But You Cant Stop Us All
Sorry,man,I forgot to say that I use the DirectX within Win 32 to create the animation.
I think there is one way: To create another DirectDraw surface array to contain the selected frames,then play them one by one,hmm i am gonna try this, or do you have any idea else?
Thanx alot !!!
Don't laugh at me,I am just a SuperNewbie.
>>I forgot to say that I use the DirectX within Win 32 to create the animation<<
Then my wee, humble website is probably the last place on earth you want to look.
I think there is a directX equivalent of NeHe's 'everything you ever wanted to know about openGL but were afraid to ask'. I think it's:
http://nexe.gamedev.net/
Thanks for the endorsement, TNT, - the cheque is in the post
CProgramming FAQ
Caution: this person may be a carrier of the misinformation virus.
What I normally do is use a pair of int's that represents the
current frame of animation (ie: xPos, yPos). Then I cycle through
them and populate a temp RECT with the values. The temp RECT
is the RECT that I'm BltFast'ing from.
here's a generic example (5 frame animation, 32 x 32 sprites):
This is a generic example. I normally use classes that would holdCode:int xPos, yPos; bool Animate, LeftFootFirst; //in the game loop if(Animate) { DoAnimation(); } void DoAnimation() { switch(xPos) { case 0: { xPos=1; LeftFootFirst=true; }break; case 1: case 2: case 3: { if(LeftFootFirst) { xPos++; } else { xPos--; } }break; case 4: { xPos=4; LeftFootFirst=false; }break; } } //in my blitting routine RECT rcTemp; SetRect(&rcTemp,xPos*32,yPos*32,(xPos*32)+32,(yPos*32)+32); lpddsBack->BltFast(rcSprite.x,rcSprite.y,lpddsSprite,&rcTemp,DDBLTFAST_WAIT);
my RECTs, etc., but hopefully this will give you the idea.
Oh and I didn't bother populating the yPos variable, but what I
normally do is have my sprites in rows. ie: the top row of the
bitmap is the walking frames, the next row down is the shooting
frames, the 3rd row down is the dying frames, or whatever.... So
I populate the yPos based on what action I'm telling the "unit" to
perform.
here's an example in API i did awhile ago.
Sometimes, the farthest point from the center is the center itself.
Your life is your canvas, it's only as beautiful as you paint it.
I, personally, would create one image with lots of different frames all side by side, then blit from the appropriate spot.
-out-
Jeff
psychobrat at gmail