The example I posted a link to uses the Sprite command and runs on an LCD PicoMite. Just tested on an ILI9488 480x320 Pico2. Try it.
Option console serial
FRAMEBUFFER create
FRAMEBUFFER write f
CLS
'brownian motion demo using sprites
Dim integer x(32),y(32),c(32)
Dim float direction(32)
Dim integer i,j,k, collision=0
Dim string q$
For i=1 To 32
direction(i)=Rnd*360 'establish the starting direction For each atom
c(i)=RGB(Rnd*255,Rnd*255,Rnd*255) 'give each atom a colour
Circle 9,9,9,1,,RGB(white),c(i) 'draw the atom
Sprite read i,0,0,19,19 'read it in as a sprite
Next i
CLS RGB(myrtle)
Box 1,1,MM.HRES-2,MM.VRES-2
k=1
For i=MM.HRES\9 To MM.HRES\9*8 Step MM.HRES\9
For j=MM.VRES\9 To MM.VRES\9*8 Step MM.VRES\5
Sprite show k,i,j,1
x(k)=i
y(k)=j
vector k,direction(k), 0, x(k), y(k) 'load up the vector move
k=k+1
Next j
Next i
'
Do
For i=1 To 32
vector i, direction(i), 1, x(i), y(i)
Sprite show i,x(i),y(i),1
If sprite(S,i)<>-1 Then
break_collision i
EndIf
Next i
FRAMEBUFFER copy f,n
Print Timer:Timer =0
Loop
'
Sub vector(myobj As integer, angle As float, distance As float, x_new As integer, y_new As integer)
Static float y_move(32), x_move(32)
Static float x_last(32), y_last(32)
Static float last_angle(32)
If distance=0 Then
x_last(myobj)=x_new
y_last(myobj)=y_new
EndIf
If angle<>last_angle(myobj) Then
y_move(myobj)=-Cos(Rad(angle))
x_move(myobj)=Sin(Rad(angle))
last_angle(myobj)=angle
EndIf
x_last(myobj) = x_last(myobj) + distance * x_move(myobj)
y_last(myobj) = y_last(myobj) + distance * y_move(myobj)
x_new=Cint(x_last(myobj))
y_new=Cint(y_last(myobj))
Return
' keep doing stuff until we break the collisions
Sub break_collision(atom As integer)
Local integer j=1
Local float current_angle=direction(atom)
'start by a simple bounce to break the collision
If sprite(e,atom)=1 Then
'collision with left of screen
current_angle=360-current_angle
ElseIf sprite(e,atom)=2 Then
'collision with top of screen
current_angle=((540-current_angle) Mod 360 )
ElseIf sprite(e,atom)=4 Then
'collision with right of screen
current_angle=360-current_angle
ElseIf sprite(e,atom)=8 Then
'collision with bottom of screen
current_angle=((540-current_angle) Mod 360)
Else
'collision with another sprite or with a corner
current_angle = current_angle+180
EndIf
direction(atom)=current_angle
vector atom,direction(atom),j,x(atom),y(atom) 'break the collision
Sprite show atom,x(atom),y(atom),1
'if the simple bounce didn't work try a random bounce
Do While (sprite(t,atom) Or sprite(e,atom)) And j<10
Do
direction(atom)= Rnd*360
vector atom,direction(atom),j,x(atom),y(atom) 'break the collision
j=j+1
Loop Until x(atom)>=0 And x(atom)<=MM.HRES-sprite(w,atom) And y(atom)>=0 And y(atom)<=MM.VRES-sprite(h,atom)
Sprite show atom,x(atom),y(atom),1
Loop
' if that didn't work then place the atom randomly
Do While (sprite(t,atom) Or sprite(e,atom))
direction(atom)= Rnd*360
x(atom)=Rnd*(MM.HRES-sprite(w,atom))
y(atom)=Rnd*(MM.VRES-sprite(h,atom))
vector atom,direction(atom),0,x(atom),y(atom) 'break the collision
Sprite show atom,x(atom),y(atom),1
Loop
End Sub