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=NHP985' /> </object>
'Make the tortoise move as fast as possible --#10
Tortoise
.
SetSpeed
(
10
)
'Have the tortoise start at 200 pixels in on the X axis --#19
Tortoise
.
SetX
(
200
)
'The current height is 40 --#1.1
height
=
40
'DrawHouse (recipe below) --#12
DrawHouse
(
)
'The current height is 120 --#16
height
=
120
'DrawHouse (recipe below) --#13
DrawHouse
(
)
'The current height is 90 --#17
height
=
90
'DrawHouse (recipe below) --#14
DrawHouse
(
)
'The current height is 20 --#18
height
=
20
'DrawHouse (recipe below) --#15
DrawHouse
(
)
'------------- Recipe for DrawHouse --#11
Sub
DrawHouse
' Change the color of the line the tortoise draws to LightGray --#9
Tortoise
.
SetPenColor
(
Colors
.
LightGray
)
' Move the tortoise the height of a house --#1.0
Tortoise
.
Move
(
height
)
' Turn the tortoise 90 degrees to the right --#2
Tortoise
.
Turn
(
90.0
)
' Move the tortoise 30 pixels --#3
Tortoise
.
Move
(
30.0
)
' Turn the tortoise 90 degrees to the right --#4
Tortoise
.
Turn
(
90.0
)
' Move the tortoise the height of a house --#5
Tortoise
.
Move
(
height
)
' Turn the tortoise 90 degrees to the left --#6
Tortoise
.
Turn
(
-
90.0
)
' Move the tortoise 20 pixels --#7
Tortoise
.
Move
(
20.0
)
' Turn the tortoise 90 degrees to the left --#8
Tortoise
.
Turn
(
-
90
)
'------------- End of DrawHouse recipe --#11
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.