1) What issues are you having with saving and loading?
For some reason, it doesn't load correctly. The tiles seem missing or off.
2) What do you mean by "pick the tiles"? Do you mean selecting tiles?
I don't know how I would go about to having the software have a tile selection area, or how I would choose a tile to draw with.
3) We need a code example to diagnose your issues or at the very least, a very detailed explanation of the issues.
I've included a zip next to the picture, I will post my code though, thank you. The save/load and tile selection are my biggest huddles right now.
4) I don't think people will have a problem helping you with coding issues if you provide snippets or the full code but you will be hard pressed to find someone willing to finish your project for you.
Thank you for your input. I do need help and it means a lot.
SetWindowTitle( "Map Creator")
// Get Device Resolution
thisWidth = getDeviceWidth()
thisHeight = getDeviceHeight()
thisMidX = thisWidth //* 0.5
thisMidY = thisHeight//* 0.5
// Size of area to be magnified ( initially 1/3 of display )
//ScissorW = thisWidth / 3.0
//ScissorH = thisHeight / 3.0
// Zoom Magnification
//myZoom# = 3.0
// Switch Device Resolution
setVirtualResolution( thisWidth , thisHeight )
SetWindowSize(thisWidth,thisHeight,0,1)
//SetVirtualResolution( 1280, 960 )
SetWindowAllowResize( 1 )
SetAntialiasMode( 0 )
SetScissor(0,0,0,0)
SetClearColor( 93, 93, 93 )
type Tile
spriteID
image
endtype
Global MapSize = 100
dim Map [MapSize,MapSize] as Tile
mapx# = 0
mapy# = 0
image = 0
button = 0
global grid = 64
DrawImage = LoadImage ("paint.png")
ImgNewButton = LoadImage ("new.png")
ImgSaveButton = LoadImage ("save.png")
ImgEditButton = LoadImage ("edit.png")
ImgObjectButton = LoadImage ("object.png")
ImgTileButton = LoadImage ("tile.png")
ImgUpLayerButton = LoadImage ("uplayer.png")
ImgDownLayerButton = LoadImage ("downlayer.png")
x#=150
y#=5
spacing# = 64
newButton = createsprite(ImgNewButton)
SetSpritePosition (newButton,x#,y#)
SetSpriteDepth ( newButton,0 )
x# = x# + spacing#
saveButton = createsprite(ImgSaveButton)
SetSpritePosition (saveButton,x#,y#)
SetSpriteDepth ( saveButton ,0 )
x# = x# + spacing#
editButton = createsprite(ImgEditButton)
SetSpritePosition (editButton,x#,y#)
SetSpriteDepth ( editButton ,0 )
x# = x# + spacing#
objectButton = createsprite(ImgObjectButton)
SetSpritePosition (objectButton,x#,y#)
SetSpriteDepth ( objectButton ,0 )
x# = x# + spacing#
tileButton = createsprite(ImgTileButton)
SetSpritePosition (tileButton,x#,y#)
SetSpriteDepth ( tileButton ,0 )
x# = x# + spacing#
upLayerButton = createsprite(ImgUpLayerButton)
SetSpritePosition (upLayerButton,x#,y#)
SetSpriteDepth ( upLayerButton ,0 )
x# = x# + spacing#
downLayerButton = createsprite(ImgDownLayerButton)
SetSpritePosition (downLayerButton,x#,y#)
SetSpriteDepth ( downLayerButton ,0 )
x# = x# + spacing#
AddVirtualJoystick(1,x#+24,y#+24,48)
DefaultMap()
FixSpriteToScreen(newButton,1)
FixSpriteToScreen(saveButton,1)
FixSpriteToScreen(editButton,1)
FixSpriteToScreen(objectButton,1)
FixSpriteToScreen(tileButton,1)
FixSpriteToScreen(upLayerButton,1)
FixSpriteToScreen(downLayerButton ,1)
global CanEditMap = 1
do
ScreenScrollspeed = 32
jScreenScrollspeed = 15
ScreenBounds = 64
ScreenX = GetViewOffsetx()
ScreenY = GetViewOffsetY()
MouseX = ScreenToWorldX(GetPointerX())
MouseY = ScreenToWorldY(GetPointerY())
joystickX# = GetVirtualJoystickX ( 1 )
joystickY# = GetVirtualJoystickY ( 1 )
mx = (floor(MouseX/grid))
my = (floor(MouseY/grid))
LeftScreenScroll = GetScreenBoundsLeft() + 10
RightScreenScroll = GetScreenBoundsRight() - 10
TopScreenScroll = GetScreenBoundsTop() + 10
BottomScreenScroll = GetScreenBoundsBottom() - 10
//print ("Mouse X")
//print(MouseX)
//print ("Mouse Y")
//print(MouseY)
CurrentSprite = GetSpriteHit(MouseX,MouseY)
print (CurrentSprite)
if CurrentSprite = 100001
CanEditMap = 0
elseif CurrentSprite
CanEditMap = 1
endif
if mx>0 and my>0 and mx<MapSize and my<MapSize
//print (map[mx,my].image)
endif
SetViewOffset ( ScreenX +joystickX#*jScreenScrollspeed ,ScreenY+ joystickY#*jScreenScrollspeed)
if GetPointerX() < LeftScreenScroll
SetViewOffset (ScreenX - 10,ScreenY)
elseif GetPointerX() > RightScreenScroll
SetViewOffset (ScreenX + 10,ScreenY)
endif
if GetPointerY() < TopScreenScroll
SetViewOffset (ScreenX,ScreenY - 10)
elseif GetPointerY() > BottomScreenScroll
SetViewOffset (ScreenX,ScreenY+ 10)
endif
if GetRawKeyPressed(27) //Esc
Exit //Close App
endif
if GetRawKeyPressed(32)
SetViewOffset ( 0,0)
endif
if GetRawMouseMiddleState() = 1
DragX = ScreenToWorldX(floor(GetPointerx())-GetViewOffsetx()+ScreenScrollSpeed)
DragY = ScreenToWorldy(floor(GetPointery())-GetViewOffsetY()+ScreenScrollSpeed)
SetViewOffset (DragX,DragY)
endif
if GetPointerPressed() = 1
MouseHit = GetSpriteHit (MouseX,MouseY)
if MouseHit = 100001
DefaultMap()
endif
endif
if GetPointerPressed() = 1
MouseHit = GetSpriteHit (MouseX,MouseY)
if MouseHit = 100002
SaveMap()
endif
endif
if GetPointerPressed() = 1
MouseHit = GetSpriteHit (MouseX,MouseY)
if MouseHit = 100003
LoadMap()
endif
endif
if CanEditMap = 1
if GetPointerState() = 1
hit = GetSpriteHit(MouseX,MouseY)
if mx=>0 and my=>0 and mx=<MapSize and my=<MapSize
hit=map[mx,my].spriteID
DeleteSprite(map[mx,my].spriteID)
DrawTile = CreateSprite (DrawImage)
SetSpritePosition(DrawTile,mx*grid,my*grid)
map[mx,my].image=1
endif
endif
if GetRawMouseRightState() = 1
hit = GetSpriteHit(MouseX,MouseY)
Deleteimage(hit)
if mx=>0 and my=>0 and mx=<MapSize and my=<MapSize
hit=map[mx,my].spriteID
DeleteSprite(hit)
//DeleteSprite(map[mx,my].spriteID)
EraseMapTileImage =LoadImage ("image.png")
EraseTile = CreateSprite (EraseMapTileImage)
SetSpriteSize(EraseTile,64,64)
SetSpritePosition(EraseTile,mx*grid,my*grid)
SetSpriteDepth ( 0,0 )
map[mx,my].image=0
endif
endif
endif
sync()
loop
function DefaultMap()
print ("New Map")
BlankMapTileImage = LoadImage ("image.png")
count = 0
for x = 0 to MapSize
for y = 0 to MapSize
if GetSpriteExists(map[x,y].spriteID)=1
DeleteSprite(map[x,y].spriteID)
endif
count = count + 1
CreateSprite(0+count,BlankMapTileImage)
//SetSpriteSize(0+count,63,63)
SetSpritePosition(0+count,x*grid,y*grid)
//setspritecolor(0+count,195,195,195,100)
map[x,y].image=0+count
next y
next x
endfunction
function SaveMap()
opentowrite (1,"map.dat")
for x = 1 to MapSize
for y = 1 to Mapsize
WriteString(1,str(map[x,y].spriteID))
writeString(1,str(map[x,y].image))
next y
next x
closefile(1)
print("map saved")
sync()
sleep(200)
endfunction
//function SaveMap()
// MapFile = OpenToWrite ("Map.dat",0)
//save the map tile images
// count = 0
//for x = 1 to MapSize
// for y = 1 to MapSize
//count = count / grid
// TileImage = map[x,y].spriteID
//if GetSpriteExists(TileImage) >= 0
// imagex = GetSpriteX (TileImage)*64
// imagey = getspritey (TileImage)*64
// WriteInteger(MapFile,imagex)
// WriteInteger(MapFile,imagey)
// WriteInteger(MapFile,TileImage)
//endif
// next y
//next x
// CloseFile(MapFile)
//endfunction
function LoadMap()
OpenToRead (1,"Map.dat")
// Read in the map tile images into our array
for x = 0 to MapSize
for y = 0 to MapSize
if GetSpriteExists(map[x,y].spriteID)=1
DeleteSprite(map[x,y].spriteID)
endif
map[x,y].spriteID = val(ReadString(1))
map[x,y].image=val(ReadString(1))
if map[x,y].image>0
CreateSprite(map[x,y].spriteID,0)
SetSpritePosition(map[x,y].spriteID,x*grid,y*grid)
endif
next y
next x
CloseFile(1)
endfunction
//function SaveMap()
// MapFile = OpenToWrite ("Map.dat",0)
//save the map tile images
// for i = 1 to 25
// for j = 1 to 25
// WriteInteger(MapFile, map[i,j] )
// next j
// next i
// CloseFile(MapFile)
//endfunction
//function LoadMap()
// MapFile = OpenToRead ("Map.dat")
// Read in the map tile images into our array
// for i = 1 to 25
// for j = 1 to 25
// map[i,j] = ReadInteger(MapFile)
// next j
// next i
// CloseFile(MapFile)
//endfunction
//dim map[250,250]
// make a random tile map
//x# = 0
//y# = 0
//image = loadimage("image.png")
//for x = 1 to 250
// for y = 1 to 250
// sprite = CreateSprite( image )
// SetSpritePosition( sprite , x#, y# )
// x# = x# + 64
// map[x,y] = image
// next y
//x# = 0
//y# = y