Sub Process_Globals
End Sub
Sub Globals
Dim h,oldh,gap, thrust As Float
Dim canvas1 As Canvas
Dim Timer1 As Timer
End Sub
Sub Activity_Create(FirstTime As Boolean)
canvas1.Initialize(Activity)
If FirstTime Then
Timer1.Initialize("Timer1", 50)
End If
Timer1.Enabled = True
h=8%y
thrust=0
gap=1%y
End Sub
Sub Timer1_Tick
oldh=h
h=h+thrust
thrust=thrust+(gap/50)
canvas1.DrawLine(45%x,oldh,55%x,oldh,Colors.Black,4%Y)
canvas1.DrawLine(45%x,h,55%x,h,Colors.Yellow,4%Y)
Activity.Invalidate
If h>97%Y Then crash
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_Touch (Action As Int, X As Float, Y As Float)
thrust=thrust-gap/4
End Sub
Sub crash
canvas1.DrawColor(Colors.Black)
If thrust <gap Then canvas1.DrawText("Landed", 5%x, 20%y,Typeface.DEFAULT, 30, Colors.Blue,"LEFT")
If thrust>=gap Then canvas1.DrawText("CRASH", 5%x, 20%y,Typeface.DEFAULT, 30,Colors.Red,"LEFT")
h=8%y
thrust=0
End Sub