'Makesprite()
SPRITE_init() ' <--------- all shape data is input here!!
add_shapes() ' <--------- all shapes are added here!!
eyes[1] = "1=6;2=7;"
StartBlink()
Sub add_shapes
For M=1 to Array.GetItemCount(s) ' 5 types shapes // Kong , trees , House , Apple , sprite
For N=1 to Array.GetItemCount(s[M]) ' repeat number //Kong=1 , trees =12 , House=1 , Apple=16 , sprite=1
ss=s[M][N] ' scale
_shx=shx[M][N] ' base point _X
_shY=shY[M][N] ' base point _Y
_shape=shape[M] ' temporary shape data
NMB=M+":"+N ' shape index
for i=1 To Array.GetItemCount(_shape)
GraphicsWindow.PenWidth = _shape[i]["pw"]
GraphicsWindow.BrushColor = _shape[i]["bc"]
GraphicsWindow.penColor = _shape[i]["pc"]
If _shape[i]["func"]="ell" Then
shp[NMB][i] = Shapes.AddEllipse(_shape[i]["width"]*ss, _shape[i]["height"]*ss)
ElseIf _shape[i]["func"]="rect" Then
shp[NMB][i] = Shapes.AddRectangle(_shape[i]["width"]*ss, _shape[i]["height"]*ss)
ElseIf _shape[i]["func"]="tri" Then
shp[NMB][i] = Shapes.Addtriangle(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss, _shape[i]["x3"]*ss, _shape[i]["y3"]*ss)
ElseIf shape[N][i]["func"]="line" Then
shp[NMB][i] = Shapes.Addline(_shape[i]["x1"]*ss, _shape[i]["y1"]*ss,_shape[i]["x2"]*ss, _shape[i]["y2"]*ss)
EndIf
Shapes.Animate(shp[NMB][i], _shape[i]["x"]*ss+_shX, _shape[i]["y"]*ss+_shY, 500)
Shapes.Rotate(shp[NMB][i], _Shape[i]["angle"])
EndFor
Endfor
Endfor
EndSub
Sub StartBlink
Timer.Interval = 500
Timer.Tick = OnTick
EndSub
Sub OnTick
' work t - times
t = t + 1
If Math.Remainder(t, 6) = 0 Then
open = "False"
Blink()
ElseIf Math.Remainder(t, 6) = 1 Then
open = "True"
Blink()
EndIf
EndSub
Sub Blink
' work iSp - splite
' work iRp - repeat
' work iEy - eye
For iSp = 1 To Array.GetItemCount(s)
_shape = shape[iSp]
_eyes = eyes[iSp]
For iRp = 1 To Array.GetItemCount(s[iSp])
_shp = shp[iSp + ":" + iRp]
For iEy = 1 To Array.GetItemCount(_eyes)
_eye = _eyes[iEy]
If open Then
Shapes.ShowShape(_shp[_eye])
Else
Shapes.HideShape(_shp[_eye])
EndIf
EndFor
EndFor
EndFor
EndSub