Microsoft Small Basic

Program Listing: DTR162
' 変数・オブジェクトの準備
x=0
y=0
migihashi = GraphicsWindow.Width
ball = Shapes.AddEllipse(30,30)
GraphicsWindow.KeyDown = MyKeyDown

jibun = Shapes.AddRectangle(80,30)
jibun_x = 0
jibun_y = GraphicsWindow.Height - 30
Shapes.Move(jibun,jibun_x,jibun_y)


'実際のアニメーション
For x=0 To migihashi
Shapes.Move(ball, x, y )
y=y+1
If(y > GraphicsWindow.Height -30) Then
Goto Hantei
EndIf
Program.Delay(10)
EndFor

' キャッチできたか判定
Hantei:
If(jibun_x GraphicsWindow.ShowMessage("キャッチ成功!", "End")
Else
GraphicsWindow.ShowMessage("残念。。", "End")
Endif
'---------------- メインルーチンはここまで ----------------------------------------


Sub MyKeyDown
a = GraphicsWindow.LastKey
If(a = "Right") Then
jibun_x = jibun_x + 5
EndIf
If(a = "Left") Then
jibun_x = jibun_x - 5
EndIf
Shapes.Move(jibun, jibun_x, jibun_y)
EndSub