Microsoft Small Basic

Program Listing: TLL449
'WINDOW
GraphicsWindow.Hide()
GraphicsWindow.Width = 700
GraphicsWindow.Height = 500
GraphicsWindow.Left = (1366 - 700) / 2
GraphicsWindow.Top = 50
GraphicsWindow.Title = "Chess Clock"
GraphicsWindow.CanResize = "false"

'ORANGE __ :)
GraphicsWindow.BrushColor = "orange"
skull = Shapes.AddEllipse(100, 100)
Shapes.Move(skull, 300, 0)
GraphicsWindow.BrushColor = "white"
mouth = Shapes.AddEllipse(60, 55)
Shapes.Move(mouth, 320, 30)
GraphicsWindow.PenColor = "orange"
GraphicsWindow.BrushColor = "orange"
rectangle = Shapes.AddRectangle(80, 30)
Shapes.Move(rectangle, 310, 30)
GraphicsWindow.PenColor = "black"
lip = Shapes.AddLine(20, 60, 80, 60)
Shapes.Move(lip, 300, 0)
GraphicsWindow.BrushColor = "white"
lefteye = Shapes.AddEllipse(35, 35)
Shapes.Move(lefteye, 315, 20)
righteye = Shapes.AddEllipse(35, 35)
Shapes.Move(righteye, 350, 20)
GraphicsWindow.BrushColor = "black"
lefteyeball = Shapes.AddEllipse(15, 15)
Shapes.Move(lefteyeball, 325, 30)
righteyeball = Shapes.AddEllipse(15, 15)
Shapes.Move(righteyeball, 360, 30)

GraphicsWindow.BrushColor = "orange"
lefteyeshut = Shapes.AddEllipse(35, 35)
Shapes.Move(lefteyeshut, 315, 20)
righteyeshut = Shapes.AddEllipse(35, 35)
Shapes.Move(righteyeshut, 350, 20)
Shapes.HideShape(lefteyeshut)
Shapes.HideShape(righteyeshut)

'CLOCKS
GraphicsWindow.BrushColor = "red"
clock1button = Shapes.AddRectangle(70, 50)
Shapes.Move(clock1button, 165, 60)
clock2button = Shapes.AddRectangle(70, 50)
Shapes.Move(clock2button, 465, 60)
GraphicsWindow.BrushColor = "slateblue"
rectangle = Shapes.AddRectangle(600, 350)
Shapes.Move(rectangle, 50, 100)
GraphicsWindow.BrushColor = "lime"
clock1 = Shapes.AddEllipse(250, 250)
Shapes.Move(clock1, 75, 150)
clock2 = Shapes.AddEllipse(250, 250)
Shapes.Move(clock2, 375, 150)
clock1vertical = Shapes.AddLine(200, 150, 200, 400)
clock1horizontal = Shapes.AddLine(75, 275, 325, 275)
clock2vertical = Shapes.AddLine(500, 150, 500, 400)
cock2horizontal = Shapes.AddLine(375, 275, 625, 275)

GraphicsWindow.BrushColor = "white"
clock1cover = Shapes.AddEllipse(200, 200)
Shapes.Move(clock1cover, 100, 175)
clock2cover = Shapes.AddEllipse(200, 200)
Shapes.Move(clock2cover, 400, 175)

'CONTROLS
GraphicsWindow.BrushColor = "black"
GraphicsWindow.FontSize = 30
clock1seconds = Controls.AddButton("0", 160, 255)
Controls.SetSize(clock1seconds, 80, 50)
clock2seconds = Controls.AddButton("0", 460, 255)
Controls.SetSize(clock2seconds, 80, 50)
num = Controls.AddButton("0", 0, 0)
Controls.HideControl(num)

'IF_STATEMENTS
'CLICK
GraphicsWindow.MouseDown = click
Sub click
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY

If x > 165 And x < 235 And y > 60 And y < 110 Then
Sound.PlayClick()
Shapes.Animate(clock1button, 165, 75, 200)
Shapes.Animate(clock2button, 465, 60, 200)
Controls.SetButtonCaption(clock1seconds, "0")
Controls.SetButtonCaption(clock2seconds, "0")
Controls.SetButtonCaption(num, "2")
Timer.Interval = 1000
EndIf

If x > 465 And x < 535 And y > 60 And y < 110 Then
Sound.PlayClick()
Shapes.Animate(clock2button, 465, 75, 200)
Shapes.Animate(clock1button, 165, 60, 200)
Controls.SetButtonCaption(clock1seconds, "0")
Controls.SetButtonCaption(clock2seconds, "0")
Controls.SetButtonCaption(num, 1)
Timer.Interval = 1000
EndIf
EndSub

'MOUSE_OVER
GraphicsWindow.MouseMove = mousemove
Sub mousemove
x = GraphicsWindow.MouseX
y = GraphicsWindow.MouseY

If x > 300 And x < 400 And y > 0 And y < 100 Then
Shapes.ShowShape(lefteyeshut)
Shapes.ShowShape(righteyeshut)
Else
Shapes.HideShape(lefteyeshut)
Shapes.HideShape(righteyeshut)
EndIf
EndSub

'TIMER
Timer.Tick = tick
Sub tick
getclock1seconds = Controls.GetButtonCaption(clock1seconds)
getclock2seconds = Controls.GetButtonCaption(clock2seconds)
getnum = Controls.GetButtonCaption(num)

If getnum = 1 Then
Controls.SetButtonCaption(clock1seconds, getclock1seconds + 1)
If getclock1seconds = 19 Then
Sound.PlayBellRing()
Controls.SetButtonCaption(num, 0)
EndIf
EndIf

If getnum = 2 Then
Controls.SetButtonCaption(clock2seconds, getclock2seconds + 1)
If getclock2seconds = 19 Then
Sound.PlayBellRing()
Controls.SetButtonCaption(num, 0)
EndIf
EndIf
EndSub

'SHOW_WINDOW
GraphicsWindow.Show()