NUM_OF_GRID=5
GRID_W=64
For i = 1 To NUM_OF_GRID
For j = 1 To NUM_OF_GRID
GraphicsWindow.DrawRectangle(i*GRID_W, j*GRID_W, GRID_W, GRID_W)
EndFor
EndFor
Timer.Interval=1000
Timer.Tick=onTick
Sub onTick
time=time-Timer.Interval
Shapes.SetText(objTime, time/1000)
If time=0 Then
Shapes.HideShape(mole)
GraphicsWindow.DrawText(150, 200, "GAME OVER!")
Program.End()
ElseIf time=MAX_TIME/2 Then
Timer.Interval=Timer.Interval/2
EndIf
If visibility="True" Then
Shapes.ShowShape(mole)
visibility="False"
Else
Shapes.HideShape(mole)
hitFlg="False"
Shapes.Zoom(mole, 1, 1)
mole_x=Math.GetRandomNumber(NUM_OF_GRID)*GRID_W
mole_y=Math.GetRandomNumber(NUM_OF_GRID)*GRID_W
Shapes.Move(mole, mole_x, mole_y)
visibility="True"
EndIf
EndSub
GraphicsWindow.MouseDown=onMouseDown
Sub onMouseDown
mouse_x = GraphicsWindow.MouseX
mouse_y = GraphicsWindow.MouseY
If mouse_x > mole_x And mouse_x < mole_x+GRID_W Then
If mouse_y > mole_y And mouse_y < mole_y+GRID_W Then
If hitFlg="False" Then
Shapes.Zoom(mole, 2, 2)
score=score+1
Shapes.SetText(objScore, score)
hitFlg="True"
EndIf
EndIf
EndIf
EndSub