Code: Select all
#Include "fbgfx.bi"
WindowTitle "Spinning Character"
Dim as Boolean Done
Dim as String Touch
Dim as Integer Frame
Dim as FB.Image Ptr Girl, Girl3D
ScreenRes 640, 480, 32
Sub Create3D(Image1 as FB.Image Ptr, Image2 as FB.Image Ptr)
Dim as Integer xPos
Dim tImage as FB.Image Ptr
tImage=ImageCreate(32, 48, 32)
For Frame as Integer=0 to 63
Line tImage, (0, 0)-(2047, 47), RGB(255, 0, 255), bf
If Frame<16 then
Put tImage, (Frame, 0), Image1, (Frame, 0)-(31-Frame, 47), Trans
Put tImage, (0, 0), Image1, (0, 48)-(Frame, 95), Trans
Put tImage, (31-Frame, 0), Image1, (31-Frame, 48)-(31, 95), Trans
EndIf
If Frame>15 and Frame<32 then
Put tImage, (Frame-16, 0), Image1, (Frame-16, 48)-(31-(Frame-16), 95), Trans
Put tImage, (0, 0), Image1, (0, 144)-(Frame-16, 191), Trans
Put tImage, (31-(Frame-16), 0), Image1, (31-(Frame-16), 144)-(31, 191), Trans
EndIf
If Frame>31 and Frame<48 then
Put tImage, (Frame-32, 0), Image1, (Frame-32, 144)-(31-(Frame-32), 191), Trans
Put tImage, (0, 0), Image1, (0, 96)-(Frame-32, 143), Trans
Put tImage, (31-(Frame-32), 0), Image1, (31-(Frame-32), 96)-(31, 143), Trans
EndIf
If Frame>47 then
Put tImage, (Frame-48, 0), Image1, (Frame-48, 96)-(31-(Frame-48), 143), Trans
Put tImage, (0, 0), Image1, (0, 0)-(Frame-48, 47), Trans
Put tImage, (31-(Frame-48), 0), Image1, (31-(Frame-48), 0)-(31, 47), Trans
EndIf
Put Image2, (32*xPos, 0), tImage, (0, 0)-(31, 47), PSet
xPos+=1
Next
ImageDestroy tImage
End Sub
Girl=ImageCreate(128, 192, 32)
Bload "Girl.bmp", Girl
Girl3D=ImageCreate(2048, 47, 32)
Create3D Girl, Girl3D
Frame=0
While Not Done
Touch=Inkey
If Touch=Chr(27) then Done=True
Line(0, 0)-(31, 47), RGB(0, 0, 0), bf
Put(0, 0), Girl3D, (32*Frame, 0)-(32*Frame+31, 47), Trans
Frame+=1 : If Frame=64 then Frame=0
Sleep 15
Wend
ImageDestroy Girl
ImageDestroy Girl3D