Need help with my 2D level editor

Blitz3D Forums/Blitz3D Programming/Need help with my 2D level editor

Guy Fawkes(Posted 2012) [#1]
Hi all, I found some code by Krylar that is a complete 2D level Editor... Problem is, it won't work with the maplib.bb :/ If someone can help get Map_SaveBinaryMap(filename$), and Map_LoadBinaryMap(filename$) to work, it would be greatly appreciated! :)


Editor.bb:





Here's maplib.bb:






Here's the demo with all the needed files:


http://www.mediafire.com/?b0i5dp9i3f9qbkb


Thanks for help! :)


Guy Fawkes(Posted 2012) [#2]
I tried looking at Krylar's Level editor, but the import of these 2 functions didn't work >< I don't know why...


Guy Fawkes(Posted 2012) [#3]
Anyone?


Guy Fawkes(Posted 2012) [#4]
Can someone help please?


Guy Fawkes(Posted 2012) [#5]
I will keep posting until someone answers. :)


Rob the Great(Posted 2012) [#6]
Running what you've provided, you get a runtime error in the maplib.bb in the function Map_SaveBinaryMap() on the line that reads "TileNumber = Map(Columns,Rows)\TileNumber". The MAV lets you know that an object does not exist, which means that you weren't using the system right. This is usually a sign of failing to initialize data (Dims, in this case) before using the functions.

Krylar's system works, but you have to let his system know first of all how large the total size of the map is. Otherwise, you're going to have an array of 1x1 (default) instead of 32x24 like you wanted.

To fix this, add this line:
Map_Init(mapx,mapy)

after these existing lines in your game:
Global mapx = 32
Global mapy = 24
Global mapx1 = 0
Global skypos
Global gridon = False
Global mapview = 1024


That should point you in the right direction.


Guy Fawkes(Posted 2012) [#7]
Ok, thanks Rob. I did EXACTLY as u said. HOWEVER... I'm having one more small problem.... It's saving the map file like this:





The first 2 numbers are fine, but the -1 is wrong...


Editor.bb:





maplib.bb (edited to work with a Decrypt function so I can actually READ the file) (Map_DecryptBinaryMap(SaveFileName$)):





Here's the decrypt function:





The format I need, is it saves the Map's width, then height, then the tile number.