Microsoft Small Basic

Program Listing: ZCS113
GraphicsWindow.Title="ラケットゲーム 2011.12.17"
GraphicsWindow.BackgroundColor="#001100"
'
gw=GraphicsWindow.Width
gh=GraphicsWindow.Height
GraphicsWindow.BrushColor="Gold"
raketto=Shapes.AddRectangle(60,12)
ball=Shapes.AddEllipse(16,16)
GraphicsWindow.MouseMove=OnMouseMove
'
x=Math.GetRandomNumber(gw-16)
y=0
deltaX=1
deltaY=1
'
Loop:
x=x+deltaX
y=y+deltaY
'
If(x>gw-16 Or x<=0) Then
deltaX=-deltaX
EndIf
If(y<=0) Then
deltaY=-deltaY
EndIf
'
rakettoX=Shapes.GetLeft(raketto)
If(y=gh-28 And x>=rakettoX And x<=rakettoX+60) Then
deltaY=-deltaY
Sound.PlayClick()
EndIf
'
Shapes.Move(ball,x,y)
Program.Delay(3)
'
If(y Goto Loop
EndIf
'
GraphicsWindow.DrawText(gw/2-40,gh/2-20,"Game Over!")
Sound.PlayChimes()
'
Sub OnMouseMove
rakettoX=GraphicsWindow.MouseX
Shapes.Move(raketto,rakettoX-60,gh-12)
EndSub