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
How do you figure out the frames? Is there a tutorial?
-RZ
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.
; LoadAnimTexture Example //modified to use a sprite instead ; ----------------------- Graphics3D 640,480 SetBuffer BackBuffer() camera=CreateCamera() light=CreateLight() RotateEntity light,90,0,0 cube=CreateSprite() PositionEntity cube,0,0,5 ; Load anim texture anim_tex=LoadAnimTexture( "pack1.png",49,64,64,0,39 ) While Not KeyDown( 1 ) ; Cycle through anim frame values. 100 represents delay, 39 represents no. of anim frames frame=MilliSecs()/100 Mod 39 ; Texture cube with anim texture frame EntityTexture cube,anim_tex,frame pitch#=0 yaw#=0 roll#=0 If KeyDown( 208 )=True Then pitch#=-1 If KeyDown( 200 )=True Then pitch#=1 If KeyDown( 203 )=True Then yaw#=-1 If KeyDown( 205 )=True Then yaw#=1 If KeyDown( 45 )=True Then roll#=-1 If KeyDown( 44 )=True Then roll#=1 TurnEntity cube,pitch#,yaw#,roll# RenderWorld Flip Wend End