While "true"
While NN<1 ' Game ends when Hit NN=1
arrowX=arrowX+dx
wrongway() ' wall check
Shapes.move(SRocket,arrowX,400) ' Rocket move
Rocket_X=Shapes.GetLeft(SRocket) ' get rocket position -X
Rocket_Y=Shapes.GetTop(SRocket) ' get rocket position -Y
collision() ' collision check
Program.Delay(10)
Shapes.Remove(screen)
endWhile
Program.Delay(1000) ' next play starts from here
arrowX=0 ' to avoid double collision
MM=0
NN=0
endwhile
sub wrongway
If arrowX<0 Then
arrowX=10
dx=2
ElseIf arrowX>GraphicsWindow.Width-Rocket_W then
arrowX=GraphicsWindow.Width-Rocket_W-5
dx=-2
EndIf
endsub
Sub collision
For i =0 To Array.GetItemCount(smete)
Shapes.Move(smete[i], shapes.GetLeft(smete[i]), shapes.Gettop(smete[i])+fall[i]) '
HalfW=SizeW[i]/2
HalfH=SizeH[i]/2
RockX=Shapes.GetLeft(smete[i]) ' get mete(rock) position -X
RockY=Shapes.Gettop(smete[i]) ' get mete(rock) position -Y
If Math.Abs(Rocket_x+Rocket_W/2-(RockX+HalfW))
NN=NN+1
Sound.PlayClick()
elseIf shapes.Gettop(smete[i])>500 Then ' 500= window-height
MM=MM+1
GraphicsWindow.Title="score: "+MM
Shapes.Move(smete[i], Math.GetRandomNumber(640),-100-Math.GetRandomNumber(200) )
EndIf
EndFor
endsub
Sub onkeydown
If Text.IsSubText("Right:Left",GraphicsWindow.LastKey)="True" Then ' key= Right or Left
dx=(text.GetCharacterCode(GraphicsWindow.LastKey)-79) ' Right Key=82 Left Key =76 dx=+3 or -3
EndIf
EndSub