;Platform Map editor NOW WITH MORE COLLISION MAPS
AppTitle "ShadowX Platform Map Editor"
gwidth=800
gheight=600
tsize=40
numtiles=4
Timer = CreateTimer(30)
showCols = False
Graphics gwidth,gheight,16,2
ClsColor 80,80,200
scr_left = 0
scr_top = 0
infile = OpenFile("map1.map");Assign infile to loading the map
If infile <> 0 Then
mapx = ReadInt(infile)
mapy = ReadInt(infile)
Else
mapx = 50
mapy = 20
EndIf
Dim map$(mapx,mapy)
If infile <> 0 Then
;read tile layer
For y = 0 To mapy-1
For x = 0 To mapx-1
map(x,y) = ReadInt(infile)
Next
Next
Else
;otherwise wipe map
For y = 0 To mapy-1
For x = 0 To mapx - 1
map(x,y) = 0
Next
Next
EndIf
CloseFile infile
img_tiles = LoadAnimImage("tileset.bmp",tsize,tsize,0,numtiles)
;LOL
;LOL
seltile = 2
SetBuffer BackBuffer()
Color 0,255,255
While Not KeyHit(1)
Cls
For y = 0 To mapy
For x = 0 To mapx
tilenum = Int(map(x,y))-1
If (x*tsize)-scr_left > -tsize And (x*tsize)-scr_left < gwidth And (y*tsize)-scr_top > -tsize And (y*tsize)-scr_top < gheight Then
;draw tile
If tilenum > -1 Then DrawImage img_tiles,(x*tsize)-scr_left,(y*tsize)-scr_top,tilenum
EndIf
Next
Next
;Scrolling around map w/ keys
If KeyDown(208) And scr_top < (mapy*tsize-gheight) Then scr_top = scr_top+15
If KeyDown(205) And scr_left < (mapx*tsize-gheight )Then scr_left = scr_left+15
If KeyDown(203) And scr_left > -menuwidth Then scr_left = scr_left-15
If KeyDown(200) And scr_top > 0 Then scr_top = scr_top-15
Rect (((MouseX()+scr_left)/tsize)*tsize)-scr_left-1,(((MouseY()+scr_top)/tsize)*tsize)-scr_top-1,tsize+2,tsize+2,0
If seltile > 0 DrawImage img_tiles,(((MouseX()+scr_left)/tsize)*tsize)-scr_left,(((MouseY()+scr_top)/tsize)*tsize)-scr_top,seltile-1
If MouseDown(1)
map((MouseX()+scr_left)/tsize,(MouseY()+scr_top)/tsize) = seltile
EndIf
If selmouse < MouseZ() Then seltile = seltile + 1
If selmouse > MouseZ() Then seltile = seltile - 1
selmouse = MouseZ()
If MouseHit(2) Then seltile = seltile + 1
If seltile > numtiles Then seltile = 0
If seltile = -1 Then seltile = numtiles
;Clear map w/C key
If KeyHit(46) Then
For y = 0 To mapy-1
For x = 0 To mapx-1
map(x,y) = 0
Next
Next
EndIf
;save map when 's' pressed
;-----------------------------------
If KeyHit(31) Then
;open output file in write mode
fileout = WriteFile("map1.map")
;write map dimensions
WriteInt fileout,mapx
WriteInt fileout,mapy
;write tile layer
For y = 0 To mapy-1
For x = 0 To mapx-1
WriteInt fileout,map(x,y)
Next
Next
CloseFile fileout
;--------------------------------------
EndIf
Flip
Wend
EndGraphics
End
Umm, what exactly do you want help with. Collision in a map editor? Do you mean being able to set tile attributes for collision? Is this map editor your own work or something you're just trying to understand?
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
dandymcgee wrote:Umm, what exactly do you want help with. Collision in a map editor? Do you mean being able to set tile attributes for collision? Is this map editor your own work or something you're just trying to understand?
Sorry to blow your spot but I know for a fact that you never wrote that code. That being said if you meant that you did write the code, otherwise sorry. I just don't like seeing other people taking credit for other people's work especially when all they've done was just scratched out certain areas in the code.
TheLividePianoist wrote:Sorry to blow your spot but I know for a fact that you never wrote that code. That being said if you meant that you did write the code, otherwise sorry. I just don't like seeing other people taking credit for other people's work especially when all they've done was just scratched out certain areas in the code.
i HATE it when people take credit for others work, personally, i prefer to make everything from scratch, because it makes me feel cool, AND i can legally remove, edit, add(to or from) any thing to do with it...
but think about making your own CPP compiler Dx exactly!! lol so instead i use code::blocks :}, the next best thing!, try to take credit for code::blocks and you'll get shot lol
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock