sync on
set text size 20
color backdrop 0
make object cube 1,1
hide object 1
rem make 2 sprites
ink rgb(250,100,120),0
box 20,20,40,40
box 10,15,20,55
box 30,25,60,60
ink rgb(180,180,180),0
box 120,120,135,145
ink rgb(55,200,120),0
box 125,120,145,130
get image 1,0,0,70,70,1
sprite 1,150,150,1
get image 2,115,115,150,150,1
sprite 2,10,10,2
cls
sp1x=10
sp1y=10
do
if upkey() and sp1y>0 then dec sp1y,1
if downkey() and sp1y0 then dec sp1x,1
if rightkey() and sp1xmemblock byte(2,x)
if memblock byte(1,x)0
delete memblock 1
delete memblock 2
exitfunction 1
endif
endif
next x
delete memblock 1
delete memblock 2
endfunction 0
sync on
set text size 20
color backdrop 0
make object cube 1,1
hide object 1
rem make 2 sprites
ink rgb(250,100,120),0
box 20,20,40,40
box 10,15,20,55
box 30,25,60,60
ink rgb(180,180,180),0
box 120,120,135,145
ink rgb(55,200,120),0
box 125,120,145,130
get image 1,0,0,70,70,1
sprite 1,150,150,1
get image 2,115,115,150,150,1
sprite 2,10,10,2
cls
sp1x=10
sp1y=10
do
if upkey() and sp1y>0 then dec sp1y,1
if downkey() and sp1y<screen height() then inc sp1y,1
if leftkey() and sp1x>0 then dec sp1x,1
if rightkey() and sp1x<screen width() then inc sp1x,1
if spritehit(2,1)
center text screen width()/2,10,"COLLISION!!"
sync
suspend for key
endif
sprite 2,sp1x,sp1y,2
sync
loop
function spritehit(sp1,sp2)
if sprite collision(sp1,sp2)=0 then exitfunction 0
create bitmap 1,sprite width(sp1),sprite width(sp2)
paste sprite sp1,0,0
make memblock from bitmap 1,1
delete bitmap 1
create bitmap 1,screen width(),screen height()
paste sprite sp1,sprite x(sp1),sprite y(sp1)
paste sprite sp2,sprite x(sp2),sprite y(sp2)
get image 1000,sprite x(sp1),sprite y(sp1),sprite x(sp1)+sprite width(sp1),sprite y(sp1)+sprite height(sp1),1
delete bitmap 1
create bitmap 1,memblock word(1,0),memblock word(1,4)
paste image 1000,0,0
make memblock from bitmap 2,1
delete bitmap 1
delete image 1000
for x=12 to get memblock size(1)-1
if memblock byte(1,x)<>memblock byte(2,x)
if memblock byte(1,x)<>0
delete memblock 1
delete memblock 2
exitfunction 1
endif
endif
next x
delete memblock 1
delete memblock 2
endfunction 0
sync on
set text size 20
color backdrop 0
make object cube 1,1
hide object 1
create bitmap 1,800,600
set current bitmap 0
rem make 2 sprites
ink rgb(250,100,120),0
box 20,20,40,40
box 10,15,20,55
box 30,25,60,60
ink rgb(180,180,180),0
box 120,120,135,145
ink rgb(55,200,120),0
box 125,120,145,130
get image 1,0,0,70,70,1
sprite 1,150,150,1
get image 2,115,115,150,150,1
sprite 2,10,10,2
cls
sp1x=10
sp1y=10
do
if upkey() and sp1y>0 then dec sp1y,1
if downkey() and sp1y<screen height() then inc sp1y,1
if leftkey() and sp1x>0 then dec sp1x,1
if rightkey() and sp1x<screen width() then inc sp1x,1
if spritehit(2,1)
center text screen width()/2,10,"COLLISION!!"
sync
suspend for key
endif
sprite 2,sp1x,sp1y,2
sync
loop
function spritehit(sp1,sp2)
if sprite collision(sp1,sp2)=0 then exitfunction 0
set current bitmap 1
paste sprite sp1,0,0
get image 1000,0,0,sprite width(sp1),sprite height(sp1),1
make memblock from image 1,1000
delete image 1000
cls
paste sprite sp1,sprite x(sp1),sprite y(sp1)
paste sprite sp2,sprite x(sp2),sprite y(sp2)
get image 1000,sprite x(sp1),sprite y(sp1),sprite x(sp1)+sprite width(sp1),sprite y(sp1)+sprite height(sp1),1
make memblock from image 2,1000
set current bitmap 0
delete image 1000
for x=12 to get memblock size(1)-1
if memblock byte(1,x)<>memblock byte(2,x)
if memblock byte(1,x)<>0
delete memblock 1
delete memblock 2
exitfunction 1
endif
endif
next x
delete memblock 1
delete memblock 2
endfunction 0