Type AnimationEffect Field FileUrl:String Field Size:IntField Frames:IntField FirstFrame:IntField LastFrame:IntField X:IntField Y:Int Method AnimationLoad() Global AttackAnimation:TImage=LoadAnimImage(FileUrl,Size,Size,Frames,FILTEREDIMAGE+MASKEDIMAGE) End Method Method DoFX() Local AnimationTimer:TTimer=CreateTimer(30,Null) Local PlayFrame=1 If TimerTicks(AnimationTimer) PlayFrame=++1 DrawImage AttackAnimation,X,Y,PlayFrame If PlayFrame = LastFrame ;PLayFrame=0 ; StopTimer(AnimationTimer) End Method End Type'load effectGlobal Kaboom:AnimationEffect= New AnimationEffectKaboom.FileUrl="F:\Kapow.png"Kaboom.Size=25Kaboom.FirstFrame=1Kaboom.LastFrame=8Kaboom.x=120Kaboom.y=120'executed at gameloop/eventKaboom.DoFX()
Type AnimationEffectField ThisPicture:TImage Field FileUrl:String Field Size:IntField Frames:IntField FirstFrame:IntField LastFrame:IntField X:IntField Y:IntField PlayFrame:Int Method AnimationLoad() ThisPicture=LoadAnimImage(Self.FileUrl,Size,Size,Frames,FILTEREDIMAGE+MASKEDIMAGE) End Method Method DoFX() For Local I:Int =FirstFrame To LastFrame DrawImage ThisPicture,X,Y,PlayFrame If PlayFrame=> LastFrame ;PlayFrame=0; Next End Method End Type'load effectGlobal Kaboom:AnimationEffect= New AnimationEffectKaboom.FileUrl="F:\Kapow.png"Kaboom.Size=25Kaboom.FirstFrame=1Kaboom.LastFrame=8Kaboom.x=120Kaboom.y=120'executed at gameloop/eventKaboom.DoFX()
Global CountT8:IntGlobal MyClock:Int Global Ztimer:TTimer = CreateTimer( 15 )Function DoMeOnce(X:Int,Y:Int,T:Int,MX:Int,Pic:Int)CountT8=CountT8+WaitTimer(ZTimer)If CountT8=MX Then CountT8=0DrawImage PicArr[Pic],X,Y,CountT8End Function Global Do:Int=0Local DoFx:IntRepeat If KeyHit(Key_1)=True Then DoFx=1If KeyHit(Key_2)=True Then DoFx=2If KeyHit(Key_3)=True Then DoFx=3If KeyHit(Key_Z)=True And Do= 0 Then Do=DO+1If DO=1 Then CountT8=0 Do=2 If DO=2 Then DoMeOnce 300,300,WaitTimer( Ztimer ),FrmMax[DoFx],DoFxIf CountT8 = FrmMax[DoFx]-1 Then DO=0 DrawText DoFx,200,100FlipClsUntil KeyDown(Key_X)