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=cht656' /> </object>
' Challenge of the month August 2012 Fire works ver.2 by NaochanON
init
(
)
While
"true"
Launch
(
)
Falling
(
)
remake
(
)
endwhile
Sub
Falling
DR
=
20
t1
=
Clock
.
ElapsedMilliseconds
For
L
=
1
To
50
If
L
<
10
Then
r
=
1
Else
r
=
r
-
0.022
EndIf
If
L
=
10
Then
Program
.
Delay
(
200
)
EndIf
For
j
=
1
To
HR
For
k
=
1
To
HM
angle
=
math
.
GetRadians
(
360
/
HR
*
j
)
X
=
Shapes
.
GetLeft
(
star
[
k
]
[
j
]
)
+
DR
*
Math
.
Cos
(
angle
)
*
k
/
HM
*
r
Y
=
Shapes
.
Gettop
(
star
[
k
]
[
j
]
)
+
DR
*
Math
.
sin
(
angle
)
*
k
/
HM
*
r
*
r
+
Gravity
*
Math
.
Power
(
Clock
.
ElapsedMilliseconds
-
t1
,
2
)
/
2
/
1000000
Shapes
.
Move
(
star
[
k
]
[
j
]
,
X
,
Y
)
Shapes
.
Zoom
(
star
[
k
]
[
j
]
,
(
40
-
L
)
/
40
,
(
40
-
L
)
/
40
)
EndFor
EndFor
Program
.
Delay
(
40
)
EndFor
EndSub
sub
Launch
'------------------------- Launch -------------------------------
Y
=
750
ddx
=
100
-
math
.
GetRandomNumber
(
200
)
' Launch direction
X
=
200
*
math
.
GetRandomNumber
(
3
)
+
math
.
GetRandomNumber
(
200
)
' Launch place
Shapes
.
Move
(
sc
,
X
-
15
,
Y
)
Gravity
=
9.8
t0
=
Clock
.
ElapsedMilliseconds
For
L
=
1
To
30
X
=
X
+
ddx
/
20
Y
=
Y
-
40
+
Gravity
*
Math
.
Power
(
Clock
.
ElapsedMilliseconds
-
t0
,
2
)
/
2
/
1000000
Shapes
.
Move
(
sc
,
X
-
15
,
Y
)
' Launching
Shapes
.
Zoom
(
sc
,
1
-
L
/
25
,
1
-
L
/
25
)
' Scale down
For
j
=
1
To
HR
For
k
=
1
To
HM
Shapes
.
Move
(
star
[
k
]
[
j
]
,
X
,
Y
)
EndFor
EndFor
Program
.
Delay
(
80
)
EndFor
Shapes
.
HideShape
(
SC
)
EndSub
Sub
init
GraphicsWindow
.
BackgroundColor
=
"Black"
GraphicsWindow
.
Top
=
0
GraphicsWindow
.
Left
=
50
GraphicsWindow
.
Width
=
1200
GraphicsWindow
.
Height
=
700
'------------------------- Hanabi base -------------------------------
GraphicsWindow
.
BrushColor
=
"Yellow"
sc
=
shapes
.
AddEllipse
(
40
,
40
)
'------------------------- color Number-------------------------------
clr
=
"1=white;2=Yellow;3=Red;4=Magenta;5=lightcyan;6=lightpink;7=Deeppink;8=lime;9=Aqua;10=Violet;"
clr
=
clr
+
"11=LightYellow;12=Lightgreen;13=Lightblue;14=Lavender;15=greenYellow"
'------------------------- Hanabi stars -------------------------------
HR
=
25
' Number of hanabi 2725 ---
HM
=
5
' Fireworks
For
j
=
1
To
HR
For
k
=
1
To
HM
'
RND
=
Math
.
GetRandomNumber
(
15
)
GraphicsWindow
.
BrushColor
=
clr
[
RND
]
GraphicsWindow
.
PenColor
=
clr
[
RND
]
star
[
k
]
[
j
]
=
Shapes
.
AddText
(
Text
.
GetCharacter
(
2
*
16
*
16
*
16
+
7
*
16
*
16
+
2
*
16
+
5
+
k
)
)
' star mark 2725 ---
Shapes
.
Move
(
star
[
k
]
[
j
]
,
500
,
900
)
EndFor
EndFor
EndSub
Sub
remake
For
j
=
1
To
HR
For
k
=
1
To
HM
'
Shapes
.
Zoom
(
star
[
k
]
[
j
]
,
1
,
1
)
EndFor
EndFor
Program
.
Delay
(
2000
)
Shapes
.
showShape
(
SC
)
EndSub
Copyright (c) Microsoft Corporation. All rights reserved.