Microsoft Small Basic

Program Listing: VHH620
' Missile Command Demo
' Original Copyright (c) 1980 ATARI
' Ported to Small Basic by Nonki Takahashi
'
Init()
Caption()
Demo()
HighScores()
Sub Init
gw = 640
gh = 480
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
colors["background"] = "Black"
colors["caption"] = "Red"
colors["fire"] = "Yellow"
colors["normal"] = "Blue"
colors["bold"] = "Red"
colors["ground"] = "Peru"
colors["city"] = "Cyan"
colors["launcher"] = "Blue"
colors["enemy"] = "Red"
GraphicsWindow.BackgroundColor = colors["background"]
EndSub
Sub Caption
GraphicsWindow.BrushColor = colors["caption"]
GraphicsWindow.FontName = "Consolas"
GraphicsWindow.FontSize = 150
GraphicsWindow.DrawBoundText(30, 50, 600, "MISSILE COMMAND")
Program.Delay(1000)
For i = 1 To 50
x = Math.GetRandomNumber(gw)
y = Math.GetRandomNumber(gh)
r = (Math.GetRandomNumber(3) + 2) * 10
d = 10
Bomb()
EndFor
EndSub
Sub Bomb
' param x, y - center of fire
' param r - radius of fire
' param d - delay [ms] (default 100)
GraphicsWindow.BrushColor = colors["fire"]
For r1 = 5 To r Step 5
GraphicsWindow.FillEllipse(x - r1, y - r1, 2 * r1, 2 * r1)
Program.Delay(d)
EndFor
For r1 = r To 5 Step -5
GraphicsWindow.BrushColor = colors["background"]
r2 = r1 + 1
GraphicsWindow.FillEllipse(x - r2, y - r2, 2 * r2, 2 * r2)
r3 = r1 - 5
r4 = r1 * 5
GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(r4, r4, 0)
GraphicsWindow.FillEllipse(x - r3, y - r3, 2 * r3, 2 * r3)
Program.Delay(d)
EndFor
EndSub
Sub Demo
EndSub
Sub HighScores
EndSub