'Activity module
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Timer1 As Timer
Dim Timer2 As Timer
Dim Timer3 As Timer
Dim Timer4 As Timer
Dim MP As MediaPlayer 'should be done in Sub Process_Globals
MP.Initialize2("MP")
MP.Load(File.DirAssets, "pichu.ogg")
Dim MP1 As MediaPlayer 'should be done in Sub Process_Globals
MP1.Initialize2("MP1")
MP1.Load(File.DirAssets, "pikachu.ogg")
Dim MP2 As MediaPlayer 'should be done in Sub Process_Globals
MP2.Initialize2("MP2")
MP2.Load(File.DirAssets, "raichu.ogg")
Dim MP3 As MediaPlayer 'should be done in Sub Process_Globals
MP3.Initialize2("MP3")
MP3.Load(File.DirAssets, "pokemon.ogg")
Dim MP4 As MediaPlayer 'should be done in Sub Process_Globals
MP4.Initialize2("MP4")
MP4.Load(File.DirAssets, "sf1.wav")
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim label4 As Label
Dim label2 As Label
Dim label5 As Label
Dim imageview1 As ImageView
Dim ImageView2 As ImageView
Dim imageview3 As ImageView
Dim imageview4 As ImageView
Dim imageview5 As ImageView
Dim imageview6 As ImageView
Dim imageview7 As ImageView
Dim imageview8 As ImageView
Dim label10 As Label
Dim t As Int
Dim c As Int
Dim l As Int
Dim m As Int
Dim r As Int
Dim Button1 As Button
Dim Button2 As Button
Dim Label6 As Label
Dim Label7 As Label
m = 1
Dim Button3 As Button
Dim Label9 As Label
Dim h As Int
Dim panel1 As Panel
Dim panel2 As Panel
Dim Button4 As Button
Dim ImageView2 As ImageView
Dim label1 As Label
Dim Label3 As Label
Dim Label8 As Label
Dim Label11 As Label
Dim label10 As Label
Dim t3 As Int
Dim zahl As Int
Dim line As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
Activity.LoadLayout("poke")
Timer1.Initialize("Timer1", 1000) ' 1000 = 1 second
Timer2.Initialize("Timer2", 333) ' 1000 = 1 second
Timer3.Initialize("Timer3", 1000) ' 1000 = 1 second
Timer4.Initialize("Timer4", 1000) ' 1000 = 1 second
t = 60
t3 = 10
MP3.play
MP3.Looping = True
panel2.Visible = False
End Sub
Sub Activity_Resume
If File.Exists(File.DirRootExternal, "highscore.txt") = True Then
Dim Reader As TextReader
Reader.Initialize(File.OpenInput(File.DirRootExternal, "highscore.txt"))
Dim line As String
line = Reader.ReadLine
Reader.Close
Label9.Text = line
End If
Dim Out As OutputStream
Out = File.OpenOutput(File.DirRootExternal, "enton.png", False)
Dim bmp As Bitmap
bmp = imageview1.Bitmap
bmp.WriteToStream(Out, 100, "PNG")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
Activity.Finish
End Sub
Sub ImageView1_Click
Timer2.Enabled = False
Timer1.Enabled = True
Timer2.Enabled = True
If Timer3.Enabled = True Then
c = c + 2
label4.text = c
Else If Timer4.Enabled = True Then
c = c
label4.text = c
Else
c = c + 1
label4.text = c
End If
End Sub
Sub Timer1_Tick
t = t - 1
label2.text = t
If label2.Text = 30 Then
r = Rnd (1, 11)
label10.text = r
If label10.Text = 1 Then
t = t + 11
label10.text = 0
Else If label10.Text = 3 Then
t = t - 9
label10.text = 0
Else If label10.Text = 5 Then
Timer3.Enabled = True
Else If label10.Text = 7 Then
Timer4.Enabled = True
Else
label10.text = 0
End If
End If
If label2.text = 0 Then
MP3.Pause
imageview1.Enabled = False
Timer2.Enabled = False
Timer1.Enabled = False
Label6.Text = c - l
h = Label6.text
If Label6.Text > Label9.Text Then
Label9.Text = h
Dim Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirRootExternal, "highscore.txt", False))
Writer.WriteLine(Label9.Text)
Writer.Close
Else
End If
If Label6.text < 100 Then
imageview1.Bitmap=LoadBitmap(File.DirAssets,"enton.png")
imageview3.Bitmap=LoadBitmap(File.DirAssets,"enton.png")
Dim Out As OutputStream
Out = File.OpenOutput(File.DirRootExternal, "enton.png", False)
Dim bmp As Bitmap
bmp = imageview3.Bitmap
bmp.WriteToStream(Out, 100, "PNG")
Else If Label6.Text < 200 Then
imageview1.Bitmap=LoadBitmap(File.DirAssets,"mauzi.png")
imageview4.Bitmap=LoadBitmap(File.DirAssets,"mauzi.png")
Else If Label6.Text < 300 Then
imageview1.Bitmap=LoadBitmap(File.DirAssets,"evoli.png")
imageview5.Bitmap=LoadBitmap(File.DirAssets,"evoli.png")
Else If Label6.Text < 400 Then
imageview1.Bitmap=LoadBitmap(File.DirAssets,"pikachu.png")
imageview6.Bitmap=LoadBitmap(File.DirAssets,"pikachu.png")
Else If Label6.Text < 500 Then
imageview1.Bitmap=LoadBitmap(File.DirAssets,"relaxo.png")
imageview7.Bitmap=LoadBitmap(File.DirAssets,"relaxo.png")
Else If Label6.Text < 600 Then
imageview1.Bitmap=LoadBitmap(File.DirAssets,"mewtwo.png")
imageview8.Bitmap=LoadBitmap(File.DirAssets,"mewtwo.png")
End If
End If
End Sub
Sub Button1_Click
imageview1.Enabled = True
t = 60
label2.Text = 60
c = 0
label4.Text = 0
l = 0
label5.Text = 0
Label6.Text = 0
Timer1.Enabled = False
If m = 0 Then
MP3.pause
Else If m = 1 Then
MP3.Play
End If
imageview1.Bitmap=LoadBitmap(File.DirAssets,"pokeei.png")
End Sub
Sub Timer2_Tick
l = l + 1
label5.Text = l
End Sub
Sub Timer3_Tick
t3 = t3 - 1
Label11.Text = t3
If Label11.Text = 0 Then
Label11.Text = 10
label10.Text = 0
Timer3.Enabled = False
End If
End Sub
Sub Timer4_tick
t3 = t3 - 1
Label11.Text = t3
If Label11.Text = 0 Then
Label11.Text = 10
Timer4.Enabled = False
End If
End Sub
Sub Button2_Click
If m = 1 Then
MP3.Pause
m = 0
Else If m = 0 Then
MP3.play
m = 1
End If
End Sub
Sub Button3_Click
panel1.Visible = False
imageview1.Visible = False
label1.visible = False
label2.visible = False
Label3.visible = False
label4.visible = False
Label8.visible = False
Label9.visible = False
panel2.Visible = True
End Sub
Sub Button4_Click
panel1.Visible = True
imageview1.Visible = True
label1.visible = True
label2.visible = True
Label3.visible = True
label4.visible = True
Label8.visible = True
Label9.visible = True
panel2.Visible = False
End Sub
Sub ImageView2_Click
Label9.Text = 0
Dim Writer As TextWriter
Writer.Initialize(File.OpenOutput(File.DirRootExternal, "highscore.txt", False))
Writer.WriteLine(Label9.Text)
Writer.Close
End Sub
Sub ImageView4_Click
End Sub
Sub ImageView5_Click
End Sub
Sub ImageView6_Click
End Sub
Sub ImageView7_Click
End Sub
Sub ImageView8_Click
End Sub