S
sionco
Guest
Hi, I have 199 small images that move around the screen, the following code draws them correctly, but the transparent background of the png image (imgOid) isn´t transparent, would each have to have it´s own canvas, what´s the best way of doing this:
:sign0104:
B4X:
Sub Timer1_Tick
Dim i As Int
For i = 0 To 199 '200 images and ´rects´
oidCanvas.DrawRect(Rect2(i),Colors.Transparent,True,1)
Activity.Invalidate2(Rect2(i))
Rect2(i).Top = oids(i).y
Rect2(i).Left = oids(i).x
Rect2(i).Bottom = oids(i).y + pSize
Rect2(i).Right = oids(i).x + pSize
oidCanvas.DrawBitmap(imgOid,Null,Rect2(i))
Activity.Invalidate2(Rect2(i))
If oids(i).x + pSize > 99%x Then
oids(i).vx = -1
Else If oids(i).x < 1%x Then
oids(i).vx = 1
End If
If oids(i).y + pSize > 99%y Then
oids(i).vy = -1
Else If oids(i).y < 48 Then
oids(i).vy = 1
End If
oids(i).x = oids(i).x + oids(i).vx
oids(i).y = oids(i).y + oids(i).vy
Next
End Sub