Hey i was working on the map editor i was trying to get sliders in and right now i have the sliders and theres arrows to move then (no clicking and dragging yet) and you can paste a tile (havn't loaded any tiles yet havn't needed to.) it is set up for layers but havn't implemented yet.
havn't worked tons i have had school and stuff but heres my code
Sync on
Sync rate 0
WinX=(640/2)/2+25
WinY=(480/2)/2+25
Set window on
Set window position WinX,WinY
#include ""
Rem used for saving the image number
Dim Tiles(100,100,2)
Rem dim and set the tile possitions
Dim Tilepos(1,100)
tilepos(0,0)=32
tilepos(1,0)=32
for Y=1 to 100
tilepos(0,Y)=Tilepos(0,Y-1)+32
tilepos(1,y)=Tilepos(1,Y-1)+32
next y
Rem draw and get the images for the sliders
draw sliders
Rem Globals (needs extended syntax)
global sx
global sy
Global show : show=1
global diffx : global diffy
global slidery
Rem White tile
ink rgb(255,255,255),0
box 0,0,32,32
get image 1,0,0,32,32
Rem the screen image is 2
show=2
Rem Draw the grid
draw grid
Rem Get the image of the grid
get image show,20,20,25,25
Do
rem paste the image
paste image show,0,0
rem make slider sprites
sprite 1,0,0,20
set sprite 1,1,0
sprite 2,0,Slidery,21
sprite 3,32,0,22
set sprite 3,1,0
sprite 4,sliderX,0,23
Rem update slide positions
slidery=(diffy)*4.41+64
sliderX=(DiffX)*6.63+64
Rem check where the mousecursor is and paste tiles
checktiles
Rem Sliders
gosub movement2
Sync
Loop
movement2:
rem press up
if mouseX()>0 and MouseX()<32
if mouseY()>32 and MouseY()<64
if mouseclick() and held=0 and diffy>0
Rem Differance for pasting the images
diffY=diffY-1
cls
For y=0 to 100
Rem Change the tile position bye 1 tile
Tilepos(1,Y)=tilepos(1,Y)+32
Rem Paste the tiles back in place
For X=0 to 100
if tiles(X,Y,0)>0
paste image Tiles(X,Y,0),tilepos(0,X),Tilepos(1,Y)
endif
next x
next y
draw grid
get image 2,0,0,640,480
held=1
else
held=0
endif
endif
endif
rem press now
if mouseX()>0 and MouseX()<32
if mouseY()>448 and MouseY()<480
if mouseclick() and held=0 and diffy<86
diffY=diffY+1
cls
For y=0 to 100
Tilepos(1,Y)=tilepos(1,Y)-32
For X=0 to 100
if tiles(X,Y,0)>0
paste image Tiles(X,Y,0),tilepos(0,X),Tilepos(1,Y)
endif
next x
next y
draw grid
get image 2,0,0,640,480
held=1
else
held=0
endif
endif
endif
rem press left
if mouseX()>32 and MouseX()<64
if mouseY()>0 and MouseY()<32
if mouseclick() and held=0 and diffX>1
diffX=DiffX-1
cls
for X=0 to 100
tilepos(0,X)=Tilepos(0,X)+32
next x
For Y=0 to 100
for X=0 to 100
if tiles(X,y,0)>0
paste image 1,tilepos(0,X),tilepos(1,Y)
endif
next X
next y
draw grid
get image 2,0,0,640,480
held=1
else
held=0
endif
endif
endif
Rem Press Right
if mouseX()>608 and MouseX()<640
if mouseY()>0 and MouseY()<32
if mouseclick() and held=0 and diffX<81
diffX=DiffX+1
cls
for X=0 to 100
tilepos(0,X)=Tilepos(0,X)-32
next x
For Y=0 to 100
for X=0 to 100
if tiles(X,y,0)>0
paste image 1,tilepos(0,X),tilepos(1,Y)
endif
next X
next y
draw grid
get image 2,0,0,640,480
held=1
else
held=0
endif
endif
endif
return
Function Checktiles
For Y=0 to 100
For X=0 to 100
rem if mouse inside tile x,y
If mouseX()>Tilepos(0,X) and MouseX()<tilepos(0,X)+32
if mouseY()>Tilepos(1,Y) and MouseY()<Tilepos(1,Y)+32
rem store x,y in variables
SX=X
SY=Y
if mouseclick() and MouseX()>32 and MouseY()>32
Rem paste the image (only set up for 1 now but thats easy to change with a few variables)
paste image 1,tilepos(0,X),Tilepos(1,Y)
rem store the image number in a variable for Saving (amung other things)
Tiles(X,Y,Layer)=1
Rem Get the screen image
Get image Show,0,0,640,480
endif
endif
endif
next x
next y
endfunction
Function draw grid
For Y=0 to 20
For X=0 to 20
Line X*32,Y*32,(X+1)*32,Y*32
Line X*32,Y*32,X*32,(Y+1)*32
line (X+1)*32,Y*32,(X+1)*32,(Y+1)*32
line X*32,(Y+1)*32,(X+1)*32,(Y+1)*32
next x
next y
endfunction
Function Draw sliders
create bitmap 1,1000,1000
ink RGB(128,128,128),0
box 0,32,32,480
ink rgb(255,255,255),0
box 0,0,32,32
ink rgb(0,0,0),0
line 0,64,32,64
line 0,448,32,448
Line 0,64,16,32
line 16,32,32,64
line 0,448,16,480
line 16,480,32,448
get image 20,0,0,32,608
cls
ink rgb(192,192,192),0
box 0,0,32,4.41
get image 21,0,0,32,4.41
cls
Ink rGB(128,128,128),0
box 0,0,608,32
ink rgb(0,0,0),0
line 32,0,32,32
Line 576,0,576,32
Line 0,16,32,0
line 0,16,32,32
line 608,16,576,0
line 608,16,576,32
get image 22,0,0,608,32
cls
ink RGB(192,192,192),0
box 0,0,6.63,32
get image 23,0,0,6.63,32
cls
set current bitmap 0
endfunction
Question!!! lol
i was thinking about how this was going to save what do you think about this(using 3 files like bn2 said)
first txt file
TileX,TileY,img
repeated for all the tiles
txt file 2
tilex,tiley,layer
so then one would store the what image the tile had the other would store what tile it had (the third file is the tileset)
to me it would make for sense to make it like this
tilex,tiley,layer,img
for each tile/layer
wait i just had a idea! so you are gunna use 3 layers right? could you use 3 txt files? 1 for layer. another for layer 2 ext....
just wondering?
and do you want the people that are doing the map to do the function for loading it or do you have another job for that? wasn't sure what was part of the "Map maker" job.