Microsoft Small Basic
Program Listing:
Embed this in your website
<object id='sbapp' data='data:application/x-silverlight-2,' type='application/x-silverlight-2' width='640' height='480'> <param name='source' value='http://smallbasic.com/program/ClientBin/SBWeb.xap'/> <param name='onError' value='onSilverlightError' /> <param name='background' value='white' /> <param name='minRuntimeVersion' value='3.0.40624.0' /> <param name='autoUpgrade' value='true' /> <param name='initParams' value='programId=HZN400' /> </object>
'Blimp - A remake of an early PC basic app.
'author: Matthew L. Parets
'Initial Default Values
'************************************************************************************
offset
=
75
textoffset
=
175
blmWid
=
500
blmHei
=
250
steps
=
8
gap
=
10
centerX
=
GraphicsWindow
.
Width
/
2
centerY
=
GraphicsWindow
.
Height
/
2
bgColor
=
"lightblue"
msg
=
"Sara and Matt...Forever!...XOXOXOXOXOXOXOXOXOXOXOXOXOXO"
'Draw the blimp
'************************************************************************************
GraphicsWindow
.
BackgroundColor
=
bgColor
GraphicsWindow
.
BrushColor
=
"blue"
GraphicsWindow
.
PenColor
=
"black"
ewid
=
blmWid
ehei
=
blmHei
For
i
=
1
To
steps
GraphicsWindow
.
FillEllipse
(
centerX
-
(
ewid
/
2
)
,
centerY
-
(
ehei
/
2
)
-
offset
,
ewid
,
ehei
)
GraphicsWindow
.
DrawEllipse
(
centerX
-
(
ewid
/
2
)
,
centerY
-
(
ehei
/
2
)
-
offset
,
ewid
,
ehei
)
hg
=
ehei
ehei
=
ehei
-
gap
gap
=
gap
+
(
gap
*
0.35
)
If
Math
.
Remainder
(
i
,
2
)
=
0
Then
GraphicsWindow
.
BrushColor
=
"blue"
GraphicsWindow
.
PenColor
=
"black"
Else
GraphicsWindow
.
BrushColor
=
"yellow"
GraphicsWindow
.
PenColor
=
"black"
EndIf
EndFor
'Draw the gandola
'************************************************************************************
GraphicsWindow
.
BrushColor
=
"brown"
GraphicsWindow
.
FillRectangle
(
centerX
-
75
,
centerY
+
(
blmHei
/
2
)
-
offset
-
5
,
150
,
20
)
GraphicsWindow
.
DrawRectangle
(
centerX
-
75
,
centerY
+
(
blmHei
/
2
)
-
offset
-
5
,
150
,
20
)
GraphicsWindow
.
DrawLine
(
centerX
+
75
,
centerY
+
(
blmHei
/
2
)
-
offset
+
5
,
centerX
+
85
,
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
GraphicsWindow
.
BrushColor
=
"lightblue"
GraphicsWindow
.
FillRectangle
(
centerX
-
73
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
15
,
10
)
GraphicsWindow
.
DrawRectangle
(
centerX
-
73
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
15
,
10
)
GraphicsWindow
.
FillRectangle
(
centerX
-
47
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
30
,
10
)
GraphicsWindow
.
DrawRectangle
(
centerX
-
47
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
30
,
10
)
GraphicsWindow
.
FillRectangle
(
centerX
-
4
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
30
,
10
)
GraphicsWindow
.
DrawRectangle
(
centerX
-
4
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
30
,
10
)
GraphicsWindow
.
FillRectangle
(
centerX
+
38
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
30
,
10
)
GraphicsWindow
.
DrawRectangle
(
centerX
+
38
,
centerY
+
(
blmHei
/
2
)
-
offset
-
0
,
30
,
10
)
'Final Setup
'************************************************************************************
GraphicsWindow
.
FontName
=
"Courier New"
GraphicsWindow
.
FontSize
=
36
sep
=
".............."
disp
=
sep
+
msg
+
sep
i
=
1
'Main control loop
While
"true"
i
=
i
+
1
If
i
>=
Text
.
GetLength
(
disp
)
-
Text
.
GetLength
(
sep
)
Then
i
=
1
EndIf
prt
=
Text
.
GetSubText
(
disp
,
i
,
text
.
GetLength
(
sep
)
)
textcolor
=
"black"
DispText
(
)
Program
.
Delay
(
100
)
textcolor
=
"yellow"
DispText
(
)
Spin
(
)
EndWhile
'Displaying marquee text on blimp
'************************************************************************************
Sub
DispText
GraphicsWindow
.
BrushColor
=
textcolor
letpos
=
24
For
j
=
0
To
6
chr
=
Text
.
GetSubText
(
prt
,
j
,
1
)
fntSiz
=
21
+
(
j
*
3
)
GraphicsWindow
.
FontSize
=
fntSiz
GraphicsWindow
.
DrawText
(
centerX
-
textoffset
+
(
letpos
)
,
centerY
-
offset
-
(
(
24
+
(
j
*
3
)
)
/
2
)
,
chr
)
letpos
=
letpos
+
(
fntsiz
*
0.75
)
EndFor
For
j
=
7
To
1
Step
-
1
chr
=
Text
.
GetSubText
(
prt
,
(
Text
.
GetLength
(
prt
)
-
j
)
,
1
)
fntSiz
=
21
+
(
(
j
-
1
)
*
3
)
GraphicsWindow
.
FontSize
=
fntsiz
GraphicsWindow
.
DrawText
(
centerX
-
textoffset
+
(
letpos
)
,
centerY
-
offset
-
(
(
24
+
(
(
j
-
1
)
*
3
)
)
/
2
)
,
chr
)
letpos
=
letpos
+
(
fntsiz
*
0.75
)
EndFor
EndSub
'Move the propeller
'************************************************************************************
Sub
Spin
GraphicsWindow
.
PenWidth
=
0.5
If
spinSwitch
=
0
Then
spinSwitch
=
1
GraphicsWindow
.
BrushColor
=
bgColor
GraphicsWindow
.
PenColor
=
bgColor
'(centerX + 85), (centerY + (blmHei/2) - offset + 5)
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
GraphicsWindow
.
BrushColor
=
"darkgray"
GraphicsWindow
.
PenColor
=
"black"
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
Else
spinSwitch
=
0
GraphicsWindow
.
BrushColor
=
bgColor
GraphicsWindow
.
PenColor
=
bgColor
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
GraphicsWindow
.
BrushColor
=
"darkgray"
GraphicsWindow
.
PenColor
=
"black"
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
,
(
centerX
+
85
)
+
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
-
9
)
GraphicsWindow
.
FillTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
GraphicsWindow
.
DrawTriangle
(
(
centerX
+
85
)
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
,
(
centerX
+
85
)
-
2
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
,
(
centerX
+
85
)
+
4
,
(
centerY
+
(
blmHei
/
2
)
-
offset
+
5
)
+
9
)
EndIf
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.