Hi Purplepickle,
Here is a random map generator example. I commented the code so you can understand it. Don't use data use something like this random map generator code.
sync on
rem our texture tiles
ink rgb(255,0,0),0
box 0,0,32,32
get image 1,0,0,32,32
ink rgb(0,255,0),0
box 0,0,32,32
get image 2,0,0,32,32
ink rgb(0,0,1),0
box 0,0,32,32
get image 3,0,0,32,32
ink rgb(255,255,0),0
box 0,0,32,32
get image 4,0,0,32,32
ink rgb(255,255,255),0
box 0,0,32,32
get image 5,0,0,32,32
rem our 2d array map
dim myMap(8,8) as integer
rem this makes sure we generate a new random value each tme
randomize timer()
rem generate a random map
GenerateRandomMap()
do
rem press any key to generate a random map
if spacekey()=1
GenerateRandomMap()
endif
rem display text to the user
center text 320,0,"Generate random tiles in your map :)"
center text 320,440,"'Press spackey' to Generate the Random Map."
sync
loop
function GenerateRandomMap()
rem reset sprite number and unitSize just incase you want random map size
sprNum = 0
unitSize = 32
rem loop through the tiles
for x = 1 to 8
for y = 1 to 8
rem pick a random tile texture
tile = rnd(4)+1
rem now put that tile in the map array
myMap(x,y) = tile
rem increase our sprite number
inc sprNum
rem start loading sprites
rem x*UnitSize is the width of the sprite
rem y*UnitSize is the height of the sprite
rem tile is are random texture it picked
rem so using this we can correctly make a nice map without problems
sprite sprNum, x*unitSize, y*unitSize, tile
next y
next x
endfunction
darkvee