Tässä esimerkki:
Code: Select all
Repeat
For numb = 0 To 10
SegNum(10,10,numb) 'x,y,numb (numb = 0-9 jos erisuuri, niin on tyhjä!)
DrawScreen
Wait 1000
Next numb
Forever
Function SegNum(x,y,numb)
Color cbDark
Line x+3,y,x+17,y
Line x+2,y+1,x+18,y+1
Line x+3,y+2,x+17,y+2
Line x+4,y+3,x+16,y+3
Line x+17,y+4,x+17,y+16
Line x+18,y+3,x+18,y+17
Line x+19,y+2,x+19,y+18
Line x+20,y+3,x+20,y+17
Line x+17,y+21,x+17,y+33
Line x+18,y+20,x+18,y+34
Line x+19,y+19,x+19,y+35
Line x+20,y+20,x+20,y+34
Line x+4,y+34,x+16,y+34
Line x+3,y+35,x+17,y+35
Line x+2,y+36,x+18,y+36
Line x+3,y+37,x+17,y+37
Line x,y+20,x,y+34
Line x+1,y+19,x+1,y+35
Line x+2,y+20,x+2,y+34
Line x+3,y+21,x+3,y+33
Line x,y+3,x,y+17
Line x+1,y+2,x+1,y+18
Line x+2,y+3,x+2,y+17
Line x+3,y+4,x+3,y+16
Line x+4,y+17,x+16,y+17
Line x+3,y+18,x+17,y+18
Line x+3,y+19,x+17,y+19
Line x+4,y+20,x+16,y+20
Color cbGreen
Select numb
Case 0
s1 = 1
s2 = 1
s3 = 1
s4 = 1
s5 = 1
s6 = 1
s7 = 0
Case 1
s1 = 0
s2 = 1
s3 = 1
s4 = 0
s5 = 0
s6 = 0
s7 = 0
Case 2
s1 = 1
s2 = 1
s3 = 0
s4 = 1
s5 = 1
s6 = 0
s7 = 1
Case 3
s1 = 1
s2 = 1
s3 = 1
s4 = 1
s5 = 0
s6 = 0
s7 = 1
Case 4
s1 = 0
s2 = 1
s3 = 1
s4 = 0
s5 = 0
s6 = 1
s7 = 1
Case 5
s1 = 1
s2 = 0
s3 = 1
s4 = 1
s5 = 0
s6 = 1
s7 = 1
Case 6
s1 = 1
s2 = 0
s3 = 1
s4 = 1
s5 = 1
s6 = 1
s7 = 1
Case 7
s1 = 1
s2 = 1
s3 = 1
s4 = 0
s5 = 0
s6 = 0
s7 = 0
Case 8
s1 = 1
s2 = 1
s3 = 1
s4 = 1
s5 = 1
s6 = 1
s7 = 1
Case 9
s1 = 1
s2 = 1
s3 = 1
s4 = 1
s5 = 0
s6 = 1
s7 = 1
Default
s1 = 0
s2 = 0
s3 = 0
s4 = 0
s5 = 0
s6 = 0
s7 = 0
EndSelect
If s1 = 1 Then
Line x+3,y,x+17,y
Line x+2,y+1,x+18,y+1
Line x+3,y+2,x+17,y+2
Line x+4,y+3,x+16,y+3
EndIf
If s2 = 1 Then
Line x+17,y+4,x+17,y+16
Line x+18,y+3,x+18,y+17
Line x+19,y+2,x+19,y+18
Line x+20,y+3,x+20,y+17
EndIf
If s3 = 1 Then
Line x+17,y+21,x+17,y+33
Line x+18,y+20,x+18,y+34
Line x+19,y+19,x+19,y+35
Line x+20,y+20,x+20,y+34
EndIf
If s4 = 1 Then
Line x+4,y+34,x+16,y+34
Line x+3,y+35,x+17,y+35
Line x+2,y+36,x+18,y+36
Line x+3,y+37,x+17,y+37
EndIf
If s5 = 1 Then
Line x,y+20,x,y+34
Line x+1,y+19,x+1,y+35
Line x+2,y+20,x+2,y+34
Line x+3,y+21,x+3,y+33
EndIf
If s6 = 1 Then
Line x,y+3,x,y+17
Line x+1,y+2,x+1,y+18
Line x+2,y+3,x+2,y+17
Line x+3,y+4,x+3,y+16
EndIf
If s7 = 1 Then
Line x+4,y+17,x+16,y+17
Line x+3,y+18,x+17,y+18
Line x+3,y+19,x+17,y+19
Line x+4,y+20,x+16,y+20
EndIf
EndFunction