Nice, it seems you really got the hang on memblocks.
-Your Problem-
get image : make memblock
-Solution-
get image : sync : make memblock
You have to sync at some point between the get image and make memblock to update the image otherwise the image doesn't exist yet.
Some other things about bitmap.
1. You do not need to use more than 2 bitmaps for screen buffering. All you need are 0 [screen] and 1 [off-screen].
2. You do not need to set current bitmap over and over, just stay with bitmap 1, as you're going to copy 1 -> 0 anyways.
3. Use "copy bitmap 1,0" befor the sync, not after.
Here's my edit of your code, I marked all the spots I edited with "REM [edit]".
sync on : hide mouse : set display mode 800,600,32
`------------------------------------------------------
`images stuff
`------------------------------------------------------
load image "Stand.png",1
load image "Run.png",2
load image "Attack.png",3
`chop up animation grids
paste image 1,0,0
`chop stand grid
for y=0 to 192 step 64
for x=0 to 704 step 64
get image 100+value,x,y,x+64,y+64
inc value
next x
next y
value=0
cls : paste image 2,0,0
`chop run grid
for y=0 to 192 step 64
for x=0 to 704 step 64
get image 200+value,x,y,x+64,y+64
inc value
next x
next y
value=0
cls : paste image 3,0,0
`chop attack grid
for y=0 to 192 step 64
for x=0 to 704 step 64
get image 300+value,x,y,x+64,y+64
inc value
next x
next y
cls
delete image 1 : delete image 2 : delete image 3
ink rgb(0,255,0),0
box 0,0,32,32
get image 1,0,0,32,32
cls
ink rgb(255,0,0),0
box 0,0,32,32
get image 2,0,0,32,32
cls
ink rgb(0,0,255),0
circle 16,16,5
get image 4,0,0,32,32
cls
`----------------------------------------------------
`setup variables
`----------------------------------------------------
x=288
y=208
movevalue=3
direction=1
stand=0
run=1
attack=2
red=rgb(255,0,0)
enemymove=1
enemyx=200
enemyy=300
dim tilecol((800-32)/32,(600-32)/32)
`make a randomized map on an off screen bmp
create bitmap 1,800,600
for y=0 to 600-32 step 32
for x=0 to 800-32 step 32
if rnd(30)=1
paste image 2,x,y
tilecol(x/32,y/32)=1
else
paste image 1,x,y
endif
next x
next y
REM [edit]
`set current bitmap 0
`make another off screen bitmap for collision
REM [edit]
`create bitmap 2,800,600
cls
for y=0 to (600-32)/32
for x=0 to (800-32)/32
if tilecol(x,y)=1 then paste image 2,x*32,y*32
next x
next y
`make a memblock to check for collision
REM [edit]
`set current bitmap 2
get image 3,0,0,799,599
REM *You must sync after a get image befor using it with memblock*
sync
if image exist(3)=1
make memblock from image 1,3
else
end
endif
` set current bitmap 0
if memblock exist(1)
memwidth=memblock dword(1,0)
else
`[edit]
`break
endif
REM [edit]
`copy bitmap 1,0
`----------------------------------------------------
`main loop
`----------------------------------------------------
do
paste image 3,0,0
gosub _input
if oldaction<>action then frame=0
gosub _update_frames
gosub _move_entity
`prevent player from leaving map
if x<0 then x=0
if x+64>800 then x=800-64
if y<0 then y=0
if y+64>600 then y=600-64
REM [edit] - Copy bitmap befor sync, not after.
copy bitmap 1,0
sync
cls
oldaction=action
loop
`---------------------------------------------------------------
`subroutines
`---------------------------------------------------------------
_input:
`[edit]
`make a memblock to check for collision
` set current bitmap 2
` get image 3,0,0,799,599
` make memblock from image 1,3
` set current bitmap 0
memwidth=799
if upkey()+rightkey()+downkey()+leftkey()=0 then action=stand
if spacekey()=1 : action=attack : else : attackflag=0 : endif
`check for move right
if rightkey()=1
direction=1
inc x,movevalue
action=run
if memblock dword(1,(((y+35)*memwidth)+x+32)*4+12)=red then dec x,movevalue
endif
`check for move down
if downkey()=1
direction=2
inc y,movevalue
action=run
if memblock dword(1,(((y+41)*memwidth)+x+32)*4+12)=red then dec y,movevalue
endif
`check for move left
if leftkey()=1
direction=3
dec x,movevalue
action=run
if memblock dword(1,(((y+35)*memwidth)+x+32)*4+12)=red then inc x,movevalue
endif
`check for move up
if upkey()=1
direction=4
dec y,movevalue
action=run
if memblock dword(1,(((y+35)*memwidth)+x+32)*4+12)=red then inc y,movevalue
endif
return
_update_frames:
`idle if needed
if action=stand
paste image 100+frame+(12*(direction-1)),x,y,1
inc frame
if frame>11 then frame=0
endif
`run if needed
if action=run
paste image 200+frame+(12*(direction-1)),x,y,1
inc frame
if frame>11 then frame=0
endif
`attack if needed
if action=attack
paste image 300+frame+(12*(direction-1)),x,y,1
if attackflag=1 and frame=0
else
inc frame
endif
if frame>11 then frame=0
attackflag=1
endif
return
_move_entity:
`make a memblock to check for collision
REM [edit]
` set current bitmap 2
` get image 3,0,0,799,599
` make memblock from image 1,3
` set current bitmap 0
memwidth=799
if enemyx>x
dec enemyx,enemymove
if memblock dword(1,(((enemyy+32)*memblock dword(1,0))+enemyx+27)*4+12)=red then inc enemyx,enemymove
endif
if enemyx<x
inc enemyx,enemymove
if memblock dword(1,(((enemyy+32)*memblock dword(1,0))+enemyx+37)*4+12)=red then dec enemyx,enemymove
endif
if enemyy>y
dec enemyy,enemymove
if memblock dword(1,(((enemyy+27)*memblock dword(1,0))+enemyx+32)*4+12)=red then inc enemyy,enemymove
endif
if enemyy<y
inc enemyy,enemymove
if memblock dword(1,(((enemyy+37)*memblock dword(1,0))+enemyx+32)*4+12)=red then dec enemyy,enemymove
endif
paste image 4,enemyx+16,enemyy+16,1
return
Good job and it works!
This is a memblock check on a single large image, the next step is to do the same thing here but on tile images.