I've tidied up my code a bit and improved it, at least I think I have. Does anyone have any information on why I should be using "paste sprite" or any other suggestions for displaying my character images?
Thanks.
` initialisation
cls
sync on
hide mouse
set display mode 800,600,16
screentilesy=16
`playing area height in tiles
screentilesx=26
`playing area width in tiles
maxlevelx=300
`maximum tiles across in a level
maxlevely=51
`maximum tiles up and down in a level
tilesize=32
`tile size in pixels
levels=1
dim backtile(levels,maxlevelx,maxlevely)
dim tiletype(levels,maxlevelx,maxlevely)
dim tileim(screentilesx,screentilesy)
dim tiletp(screentilesx,screentilesy)
`horztile for horizon tiles, parallax scrolling
`dim horztile(300,10)
`*******************************************************************************************************************
`check for input devices
perform checklist for control devices
contdevs=checklist quantity()
j=1
`print control devices available
if contdevs>0
for j=1 to contdevs
print j;" ";checklist string$(j)
next j
endif
print j;" ";"Keyboard control"
`wait for valid input
while cchoice<1 or cchoice>j
cchoice=scancode()-1
sync
endwhile
if contdevs>0 then set control device checklist string$(cchoice)
cls
`*******************************************************************************************************************
`first 100 images are background tiles
load bitmap "tilebitmapSML.bmp",1
for row=0 to 9
for col=0 to 9
get image ((row*10)+col+1),(col*tilesize),(row*tilesize),((col+1)*tilesize),((row+1)*tilesize)
next col
next row
delete bitmap 1
load image "muzzwalkR.bmp",101
load image "muzzwalk2R.bmp",102
load image "muzzwalkL.bmp",103
load image "muzzwalk2L.bmp",104
`make matrix 1,640,128,100,20
`prepare matrix texture 1,1,10,10
`fill matrix 1,0,6
`randomise background
for lvl=1 to levels
for y=1 to maxlevely
for x=1 to maxlevelx
tiletype(lvl,x,y)=rnd(6)+1
backtile(lvl,x,y)=rnd(3)+1
`set matrix tile 1,x,z,tile
next x
next y
next lvl
`read background for level 1
restore levelone
lvl=1
for y=17 to 33
`read only middle 17-33 tiles for now
for x=1 to 31
`eventually this 31 will be maxlevelx
read tiletype(lvl,x,y)
read backtile(lvl,x,y)
`set matrix tile 1,x,z,tile
next x
next y
`position camera 97,120,64
`point camera 97,0,64
`scroll background
remstart
for j=98 to 640
wait 1
position camera j,120,64
point camera j,0,64
next j
remend
level=1
lvlx=1
lvly=18
xview=(lvlx-1)*tilesize
yview=(lvly-1)*tilesize
plonex#=197
ploney#=285
ploneanim=101
ploneface$="right"
xprogress=0
movingxr=1
movingxl=0
movingyu=0
movingyd=0
xtoffset=0
ytoffset=0
do
`draw background
remstart
for x=xview to xview+screentilesx-1
for y=yview to yview+screentilesy-1
tileim((x-xview)+1,(y-yview)+1)=backtile(level,x,y)
tiletp((x-xview)+1,(y-yview)+1)=tiletype(level,x,y)
paste image tileim((x-xview)+1,(y-yview)+1),((x-xview)+1)*tilesize-xtoffset,((y-yview)+1)*tilesize-ytoffset
`paste image backtile(x,y),(x-1)*tilesize-xprogress,(y-1)*tilesize
next y
next x
remend
for x=0 to screentilesx-1
for y=0 to screentilesy-1
tileim(x,y)=backtile(level,lvlx+x,lvly+y)
tiletp(x,y)=tiletype(level,lvlx+x,lvly+y)
paste image tileim(x,y),x*tilesize-xtoffset,y*tilesize-ytoffset
`paste image backtile(x,y),(x-1)*tilesize-xprogress,(y-1)*tilesize
next y
next x
remstart
if joystick up()=1 then ploney#=ploney#-1
if joystick down()=1 then ploney#=ploney#+1
if joystick right()=1 then plonex#=plonex#+1
if joystick left()=1 then plonex#=plonex#-1
remend
jstckx=joystick x()
jstcky=joystick y()
if jstckx>0 then ploneface$="right"
if jstckx<0 then ploneface$="left"
if movingxr=1 and jstckx>0 and plonex#>400
xview=xview+jstckx/500
else
plonex#=plonex#+jstckx/500
endif
ploney#=ploney#+jstcky/400
` CALCULATE TILEPLAYER IS ON
` CALCULATE TILEPLAYER IS ON
` CALCULATE TILEPLAYER IS ON
` CALCULATE TILEPLAYER IS ON
` CALCULATE TILEPLAYER IS ON
`calculate tile player is on
ctilex=int((plonex#/800)*(800/32))+xtprgs
ctiley=int(((ploney#+1)/600)*(600/32))+9
BOX 0,0,96,96
TEXT 0,12,"plonex#="+str$(plonex#)
TEXT 0,24,"ploney#="+str$(ploney#)
TEXT 0,36,"ctilex="+str$(ctilex)
TEXT 0,48,"ctiley="+str$(ctiley)
`paste image 7,ctilex#*tilesize,ctiley#*tilesize
paste image 7,ctilex*tilesize,ctiley*tilesize
`if jstcky<0 and tiletp(ctilex,ctiley)=0 then ploney#=ploney#-jstcky/400
if ploneface$="right" then ploneanim=101
if ploneface$="left" then ploneanim=103
sprite 1,plonex#,ploney#,ploneanim
remstart
`move sprite 1 backwards and forwards
for j=197 to 500 step 10
if mwanim#/4=int(mwanim#/4)
if mwk=0 then mwk=1 else mwk=0
endif
if mwk=0 then sprite 1,j,285,2 else sprite 1,j,285,3
inc mwanim#
sync
wait 1
next j
for j=500 to 197 step -10
if mwanim#/4=int(mwanim#/4)
if mwk=0 then mwk=1 else mwk=0
endif
if mwk=0 then sprite 1,j,285,4 else sprite 1,j,285,5
inc mwanim#
sync
wait 1
next j
remend
sync
lvlx=int(xview/tilesize)+1
xtoffset=xview-(lvlx-1)*tilesize
loop
levelone:
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6,1,6
data 1,6,1,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