Dim screen As Canvas
'-----Draw the Sprite onto the canvas--------
Sub Draw (spr As ddSprite,rct As Rect, canv As Canvas)
canv.DrawBitmapRotated(spr.img,Null,rct,0)
End Sub
Sub tmr_Tick
Activity.Invalidate
animate
End Sub
Sub Animate
Dim spr As ddSprite
Dim rct As Rect
If nextcol > col Then
nextcol = 0
NewLevel
End If
For i=0 To nextcol-1
For j = 0 To row -1
spr=aLevel(i,j)
rct=aScreenRect(i,j)
If spr.alive =1 Then
ddSprite.Draw(spr,rct,screen)
End If
Next
Next
'DrawPlayerColors
End Sub
Sub Activity_Touch(Action As Int, X As Float, Y As Float)
'If Not(Action = Activity.ACTION_DOWN) Then Return
Dim r,c As Int
Dim spr As ddSprite
Dim tx, ty As Int
spr = aPlayerColors(0)
If action= Activity.ACTION_DOWN Then
tx = X
ty = Y
spr = aPlayerColors(0)
sounds.Play(pop, 1, 1, 1, 0, 1)
prct.Left = X-24
prct.Right = X+24
prct.Top = Y-24
prct.Bottom = Y+24
ddSprite.Draw(spr,prct,screen)
activity.Invalidate2(prct)
Else
If action = activity.ACTION_MOVE Then
prct.Left = X-24
prct.Right = X + 24
prct.Top = Y-24
prct.Bottom = Y+24
ddSprite.Draw(spr,prct,screen)
activity.Invalidate2(prct)
End If
End If
End Sub