The following code shows you how to setup the beginings of a simple single screen tilemap editor. :)
// --------------------------------- //
// Project: SSMapEditor (Single Screen Map Editor) By Amon - No Save possible
// Save Coming in Version 2
// Start: Sunday, December 27, 2009
// IDE Version: 7.203
SETCURRENTDIR("Media") // seperate media and binaries?
LOADANIM "tileset.png",0,25,25
LOADSPRITE "arrow.png",1
SETSCREEN 800,600,0
CurrentTile = 0
MAPWIDTH = 32 // MapWidth
MAPHEIGHT = 24 // MapHeight
TileWidthHeight = 25
GLOBAL MouseX, MouseY,MB1,MB2
DIM Map#[MAPWIDTH][MAPHEIGHT]
FOR x1 = 0 TO MAPWIDTH - 1
FOR y1 = 0 TO MAPHEIGHT - 1
Map[x1][y1] = RND(4)
NEXT
NEXT
WHILE KEY(01) = 0
BLACKSCREEN
FillMap()
DrawMap()
DRAWSPRITE 1,MouseX/MouseX*MouseX,MouseY/MouseY*MouseY
SHOWSCREEN
WEND
FUNCTION DrawMap:
FOR xiter = 0 TO MAPWIDTH -1
FOR yiter = 0 TO MAPHEIGHT - 1
IF Map[xiter][yiter] = 0
DRAWANIM 0,0,xiter * TileWidthHeight, yiter * TileWidthHeight
ENDIF
IF Map[xiter][yiter] = 1
DRAWANIM 0,1,xiter * TileWidthHeight, yiter * TileWidthHeight
ENDIF
IF Map[xiter][yiter] = 2
DRAWANIM 0,2,xiter * TileWidthHeight, yiter * TileWidthHeight
ENDIF
IF Map[xiter][yiter] = 3
DRAWANIM 0,3,xiter * TileWidthHeight, yiter * TileWidthHeight
ENDIF
IF Map[xiter][yiter] = 4
DRAWANIM 0,4,xiter * TileWidthHeight, yiter * TileWidthHeight
ENDIF
IF Map[xiter][yiter] = 5
DRAWANIM 0,5,xiter * TileWidthHeight, yiter * TileWidthHeight
ENDIF
NEXT
NEXT
ENDFUNCTION
FUNCTION FillMap:
IF KEY(57) = 1
CurrentTile = CurrentTile + 1
IF CurrentTile >5 THEN CurrentTile = 0
ENDIF
MOUSESTATE MouseX, MouseY, MB1, MB2
IF MB1 = 1
Map[MouseX/TileWidthHeight][MouseY/TileWidthHeight] = CurrentTile
ENDIF
ENDFUNCTION
[attachment deleted by admin]