`The usual setup
hide mouse
autocam off
sync on
sync rate 0
randomize timer()
backdrop off
 
`Make the images
box 0,0,255,255,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
get image 1,0,0,255,255,1
box 0,0,255,255,rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
get image 2,0,0,255,255,1
cls
box 0,0,screen width(),screen height(),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
for i=1 to 20
   make object sphere i,rnd(19)+1,rnd(2)+3,rnd(2)+3
   texture object i,1
   position object i,rnd(100)-50,rnd(100)-50,rnd(100)
   ink rgb(rnd(255),rnd(255),rnd(255)),0
   text rnd(screen width()),rnd(screen height()),"First image!"
next i
sync
get image 1,0,0,screen width(),screen height(),1
delete objects 1,20
cls
box 0,0,screen width(),screen height(),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255)),rgb(rnd(255),rnd(255),rnd(255))
for i=1 to 20
   make object sphere i,rnd(19)+1,rnd(2)+3,rnd(2)+3
   texture object i,2
   position object i,rnd(100)-50,rnd(100)-50,rnd(100)
   ink rgb(rnd(255),rnd(255),rnd(255)),0
   text rnd(screen width()),rnd(screen height()),"Second image!"
next i
sync
get image 2,0,0,screen width(),screen height(),1
delete objects 1,20
cls
 
`necessary setup
type coord
   x as integer
   y as integer
endtype
sprite 1,0,0,1
 
`main loop
do
sync
if rightkey()=1
   if sprite image(1)=1
      right_slide(1,2)
   else
      right_slide(1,1)
   endif
endif
if leftkey()=1
   if sprite image(1)=1
      left_slide(1,2)
   else
      left_slide(1,1)
   endif
endif
if upkey()=1
   if sprite image(1)=1
      up_slide(1,2)
   else
      up_slide(1,1)
   endif
endif
if downkey()=1
   if sprite image(1)=1
      down_slide(1,2)
   else
      down_slide(1,1)
   endif
endif
if spacekey()=1
   if sprite image(1)=1
      random(1,2)
   else
      random(1,1)
   endif
endif
if returnkey()=1
   if sprite image(1)=1
      new(1,2)
   else
      new(1,1)
   endif
endif
if shiftkey()=1
   if sprite image(1)=1
      new2(1,2)
   else
      new2(1,1)
   endif
endif
if controlkey()=1
   if sprite image(1)=1
      new3(1,2)
   else
      new3(1,1)
   endif
endif
loop
 
`spr is sprite you want it to affect
`img is the image you want the sprite to become
function right_slide(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
for x=0 to width-1
   for y=0 to height-1
      write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   next y
   make image from memblock img,1
   sync
next x
delete memblock 1
delete memblock 2
endfunction
 
function left_slide(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
for x=width-1 to 0 step -1
   for y=0 to height-1
      write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   next y
   make image from memblock img,1
   sync
next x
delete memblock 1
delete memblock 2
endfunction
 
function up_slide(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
for y=height-1 to 0 step -1
   for x=0 to width-1
      write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   next y
   make image from memblock img,1
   sync
next x
delete memblock 1
delete memblock 2
endfunction
 
function down_slide(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
for y=0 to height-1
   for x=0 to width-1
      write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   next y
   make image from memblock img,1
   sync
next x
delete memblock 1
delete memblock 2
endfunction
 
function random(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
local dim points(width*height) as coord
l=0
for x=0 to width-1
   for y=0 to height-1
      inc l
      points(l).x=x
      points(l).y=y
   next y
next x
for l=0 to 1000000
   a=rnd(width*height)
   b=rnd(width*height)
   x1=points(a).x
   y1=points(a).y
   x2=points(b).x
   y2=points(b).y
   points(a).x=x2
   points(a).y=y2
   points(b).x=x1
   points(b).y=y1
next l
for l=0 to width*height
   x=points(l).x
   y=points(l).y
   write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   if l mod 200=0
      make image from memblock img,1
      sync
   endif
next l
undim points(0)
delete memblock 1
delete memblock 2
endfunction
 
function new(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
local dim points(width*height) as coord
l=0
for x=0 to width-1
   for y=0 to height-1
      inc l
      points(l).x=x
      points(l).y=y
   next y
next x
for l=0 to width*height
   a=rnd(width*height)
   b=width*height-a
   x1=points(a).x
   y1=points(a).y
   x2=points(b).x
   y2=points(b).y
   points(a).x=x2
   points(a).y=y2
   points(b).x=x1
   points(b).y=y1
next l
for l=0 to width*height
   x=points(l).x
   y=points(l).y
   write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   if l mod 200=0
      make image from memblock img,1
      sync
   endif
next l
undim points(0)
delete memblock 1
delete memblock 2
endfunction
 
function new2(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
local dim points(width*height) as coord
l=0
for x=0 to width-1
   for y=0 to height-1
      inc l
      points(l).x=x
      points(l).y=y
   next y
next x
for l=0 to width*height-10000
   a=l+rnd(10000)
   b=l+rnd(10000)
   x1=points(a).x
   y1=points(a).y
   x2=points(b).x
   y2=points(b).y
   points(a).x=x2
   points(a).y=y2
   points(b).x=x1
   points(b).y=y1
next l
for l=0 to width*height
   x=points(l).x
   y=points(l).y
   write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   if l mod 200=0
      make image from memblock img,1
      sync
   endif
next l
undim points(0)
delete memblock 1
delete memblock 2
endfunction
 
function new3(spr,img)
make memblock from image 1,sprite image(spr)
make memblock from image 2,img
delete image img
make image from memblock img,1
set sprite image spr,img
width=memblock dword(1,0)
height=memblock dword(1,4)
local dim points(width*height) as coord
l=0
for x=0 to width-1
   for y=0 to height-1
      inc l
      points(l).x=x
      points(l).y=y
   next y
next x
for l=0 to 100000
   a=rnd(width*height-1000)
   b=a+1000
   x1=points(a).x
   y1=points(a).y
   x2=points(b).x
   y2=points(b).y
   points(a).x=x2
   points(a).y=y2
   points(b).x=x1
   points(b).y=y1
next l
for l=0 to width*height
   x=points(l).x
   y=points(l).y
   write memblock dword 1,(y*width+x)*4+12,memblock dword(2,(y*width+x)*4+12)
   if l mod 200=0
      make image from memblock img,1
      sync
   endif
next l
undim points(0)
delete memblock 1
delete memblock 2
endfunction