sprite animation
Blitz3D Forums/Blitz3D Programming/sprite animation
| ||
I have a large PNG file of an explosion and I want to use this as an animated sprite. I don't understand how to do this. How do you figure out the frames? Is there a tutorial? -RZ |
| ||
I think you can use the loadanimtexture command. (with createsprite rather than loadsprite). |
| ||
I think I am still being vague. I got an image that is a series of frames but IS NOT ANIMATED. There are 9 images toto like this: 1 2 3 4 5 6 7 8 9 And those 9 images make up one BIG picture. I know that there is a way to load parts of the image as frames of an animated sprite but I can't remember where I have see that before. Has anyone seen this example? -RZ |
| ||
I thought jfk answered your question... |
| ||
But its the how to get the sprite to flip between frams that has me boggled. I can get the image to load and animate like this: Graphics3D 800,600,16,2 SetBuffer BackBuffer() campivot = CreatePivot() cam = CreateCamera(campivot) MoveEntity cam,0,0,-5 flame = LoadAnimImage("textures\flame.png",64,64,0,16) While Not KeyDown(1) ; The next statment checks to see if 100 milliseconds has passes since we ; last changed frames. Change the 100 to higher and lower values to ; make the animation faster or slower. If MilliSecs() > tmrSparks + 25 Then tmrSparks=MilliSecs() ; 'reset' the timer frmSparks=( frmSparks + 1 ) Mod 16; increment the frame, flip to 0 if we are out End If DrawImage flame,300,300,frmSparks ; draw the image ; updateworld ; renderworld Flip Wend EndBut notice that updateworld and renderworld are REM out... I don't see the image if they are left in. I am trying to make a torch. -RZ |
| ||
When you use DrawImage, you are not using a sprite, you are simply drawing the image directly to the current buffer. |
| ||
Yeah I finally found that in the codebase... Works OK... |