Hi im trying to make a 2d RTS/RPG (not sure yet) 2d game. Iv been running into some problems and here is one...
`--------------------------------------------------------------------------------------------
`-******************************************************************************************-
`-*************************************2D STRATEGY GAME*************************************-
`-******************************************************************************************-
`--------------------------------------------------------------------------------------------
`--------------------------------------------------------------------------------------------
`- INITIALISING -
`--------------------------------------------------------------------------------------------
`setup screen
set display mode 800,600,0
hide mouse
set image colorkey 255,0,255
`set variables
cursor = 999
tilesizex = 32
tilesizey = 32
mapsizex = 800
mapsizey = 600
dim tiles(20,25)
`load all files
load image "media/game/cursor.bmp", cursor
load image "media/game/exitoff.bmp", 100
load image "media/game/exiton.bmp", 101
load image "media/tiles/dirt.bmp", 20
load image "media/tiles/grass.bmp", 1
load image "media/tiles/grass_dirt_bottom.bmp", 3
load image "media/tiles/grass_dirt_bottomleft.bmp", 2
load image "media/tiles/grass_dirt_bottomright.bmp", 4
load image "media/tiles/grass_dirt_left.bmp", 5
load image "media/tiles/grass_dirt_right.bmp", 6
load image "media/tiles/grass_dirt_top.bmp", 8
load image "media/tiles/grass_dirt_topleft.bmp", 7
load image "media/tiles/grass_dirt_topright.bmp", 9
load image "media/tiles/water.bmp", 10
load image "media/tiles/water_bottom.bmp", 13
load image "media/tiles/water_bottomleft.bmp", 12
load image "media/tiles/water_bottomright.bmp", 14
load image "media/tiles/water_left.bmp", 15
load image "media/tiles/water_right.bmp", 16
load image "media/tiles/water_top.bmp", 18
load image "media/tiles/water_topleft.bmp", 17
load image "media/tiles/water_topright.bmp", 19
`makes the map
for y = 1 to 20
for x = 1 to 25
read z
tiles(y,x) = z
next x
next y
`sprites all the buttons to the screen
sprite 100,715,5,100
`--------------------------------------------------------------------------------------------
`- MAIN LOOP -
`--------------------------------------------------------------------------------------------
do
`clears screen
cls
`get cursorx + cursory
cursorx = mousex()
cursory = mousey()
`sprite the new cursor onto the mouse
sprite cursor, cursorx, cursory, cursor
`checks if the mouse is over any buttons
if sprite collision(cursor,100) then exiton = 1
if sprite collision(cursor,100) = 0 then exiton = 0
if exiton = 1 then sprite 100,715,5,101 else sprite 100,715,5,100
if exiton = 1 and mouseclick() = 1 then exit
`sprites the tiles to the screen
for y = 1 to 20
for x = 1 to 25
paste image tiles(y,x), tileposx, tileposy
tileposx = tileposx + 32
n = n + 1
next x
tileposy = tileposy + 32
tileposx = 0
next y
loop
`--------------------------------------------------------------------------------------------
`- SUB ROUTINES + FUNCTIONS -
`--------------------------------------------------------------------------------------------
Map:
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10, 2, 3, 3, 3, 3, 4,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10, 5, 1, 1, 1, 1, 6,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10, 5, 1, 1, 1, 1, 6,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10, 5, 1, 1, 1, 1, 6,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10, 5, 1, 1, 1, 1, 6,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10, 7, 8, 8, 8, 8, 9,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
data 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
when i run it it says "Runtime Error 501 - Image number illeagle at line 83"
im not sure what the prob is but i think it has to do with Data... help would be appreciated