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=nts150' /> </object>
''
For
i
=
1
To
10
APL
[
i
]
=
Shapes
.
AddImage
(
"http://sozaidas.com/sozai/010801fruit/010801fruit02-trans.png"
)
Shapes
.
Move
(
APL
[
i
]
,
Math
.
GetRandomNumber
(
640
)
,
-
100
-
Math
.
GetRandomNumber
(
200
)
)
fal
[
i
]
=
(
5
+
Math
.
GetRandomNumber
(
10
)
)
/
5
Shapes
.
Zoom
(
APL
[
i
]
,
fal
[
i
]
/
3
,
fal
[
i
]
/
3
)
EndFor
bct
=
Shapes
.
AddRectangle
(
40
,
20
)
'---------------- backet ---------------
GraphicsWindow
.
FontSize
=
20
msg
=
Shapes
.
AddText
(
" "
)
While
"true"
Shapes
.
move
(
bct
,
GraphicsWindow
.
MouseX
,
430
)
' move backet
For
i
=
1
To
10
Shapes
.
Move
(
APL
[
i
]
,
shapes
.
GetLeft
(
APL
[
i
]
)
,
shapes
.
Gettop
(
APL
[
i
]
)
+
fal
[
i
]
)
' move apples
If
Math
.
Abs
(
Shapes
.
GetLeft
(
bct
)
-
Shapes
.
GetLeft
(
APL
[
i
]
)
)
<
80
And
Math
.
abs
(
Shapes
.
GetTop
(
bct
)
-
Shapes
.
Gettop
(
APL
[
i
]
)
)
<
20
Then
NN
=
NN
+
1
Sound
.
PlayClick
(
)
Shapes
.
move
(
APL
[
i
]
,
Math
.
GetRandomNumber
(
640
)
,
-
100
-
Math
.
GetRandomNumber
(
200
)
)
'
elseIf
shapes
.
Gettop
(
APL
[
i
]
)
>
500
Then
MM
=
MM
+
1
Shapes
.
Move
(
APL
[
i
]
,
Math
.
GetRandomNumber
(
640
)
,
-
100
-
Math
.
GetRandomNumber
(
200
)
)
EndIf
EndFor
Shapes
.
SetText
(
msg
,
"Hit count= "
+
NN
+
" Total= "
+
(
MM
+
NN
)
)
Program
.
Delay
(
10
)
endWhile
Copyright (c) Microsoft Corporation. All rights reserved.