Microsoft Small Basic

Program Listing: LDH867
'Published ID#
'Hint: you will need to use the ProgramWindow & ShapeMaker objects.
'PrepareColorPalette (recipe below) --#10
PrepareColorPalette()
'Set the CreateBubble recipe (below) to be called when the mouse is clicked --#3
ProgramWindow.MouseClicked = CreateBubble

'------------- Recipe for PrepareColorPalette --#9
Sub PrepareColorPalette
' Add alice blue to the color wheel --#5
ColorWheel.AddColor(Colors.AliceBlue)
' Add blue to the color wheel --#6
ColorWheel.AddColor(Colors.Blue)
' Add dark blue to the color wheel --#7
ColorWheel.AddColor(Colors.DarkBlue)
' Add purple to the color wheel --#8
ColorWheel.AddColor(Colors.Purple)
'------------- End of PrepareColorPalette recipe --#9
EndSub

'------------- Recipe for CreateBubble --#2
Sub CreateBubble
' Remove the current bubble --#11
ShapeMaker.RemoveShape(bubble)
' Change the color for the next circle to the next color from the color wheel --#4
ShapeMaker.SetColorForNextShape(ColorWheel.GetNextColor())
' Set the radius for the circle to a random number between 10 and 50 --#1.2
radius = Math.getRandomNumber(40)+10
' Create the bubble --#1.1
bubble = ShapeMaker.CreateCircle(radius)
' Move the center of the bubble to the current position of the mouse on the window --#1.0 (Fake at 20,20) &#
ShapeMaker.CenterShapeAt(bubble, ProgramWindow.GetMouseX(), ProgramWindow.GetMouseY())
'------------- End of CreateBubble recipe --#2
EndSub