MapEditor
Blitz3D Forums/Blitz3D Beginners Area/MapEditor
| ||
I've been working on a 2d/3d sidescrolling game and I'm wanting a Map Editor for it so I can make maps faster. I've made a Map Editor but I can't figure out how to load the tiles right. In the following link, I have coded two different ways to save and load, the other way is inside the functions, but Commented. http://rapidshare.com/files/110708814/MapEditor.rar You can open the files using Notepad that are saved as WriteLine to see what exactly is being saved. Use middle mouse scroll wheel to change the choice to 1 or 2 for 2 different tiles, any other number will remove the tile. F1 to Save F2 to Load Updated... http://rapidshare.com/files/113079991/MapEditor.zip |
| ||
I tried to unpack with 7Zip, but it says the format architecture was not supported (readme says it can do RAR, probably a version conflict - too much trouble). Next time use Zip, one reason less why people don't respond. Besides, I think there isn't much to say, and downloading, extracting and checking someones code is rather hard work. Probably you should post some code right here in codeboxes and discuss good ways to save maps. |
| ||
You want to use WinRar jfk. Anyhow, I thought I'd help out. Hosted here as mapeditor.zip: [removed] |
| ||
I don't have blitz installed here but the problem looks like you are storing image handles as the tile type. This will not be consistent when you reload. I would have thought they should be stored as integers too? I'm with jfk too, stick to zip. |
| ||
yeah, RAR's good, but not for public consumption as ZIP is built into XP. I'll take a look at the editor tonight and give some feedback then. |
| ||
What you probably need to start with is somthing like this If MouseDown(1) Select choice Case 1 RemoveTile() PlaceTile(x,y,choice) Case 2 RemoveTile() PlaceTile(x,y,choice) Default RemoveTile() End Select EndIf Then when you display your graphics you can put a green tyle if img is 1 and a grey if img is 2. This is just a start and one of a few approaches, but should put you in the correct direction. |
| ||
Sorry for not saying anything but I had to move to a different house and couldn't get the internet connection to work... anyways http://rapidshare.com/files/113079991/MapEditor.zip I figured out what I did wrong! When trying to load a file, it read only a few lines and stopped and for some reason it didn't make the tile show up right... but you'll see what I did in the function LoadMap. I'm actually really proud of myself that I finally got it after so long... all by myself. |
| ||
Right now, the way I have the maps loading into my 3D game is it places pre-made cubes depending on where the tiles are on the 2d map. The way I'm wanting it is so that the 3D loader creates its own meshes depending on the location of the tiles. I was playing around with creating a blitz3d mesh but then I found a problem. Why is it not coloring the vertices like I tell it to? Graphics3D 800,600,32,2 SeedRnd MilliSecs() cam = CreateCamera() PositionEntity cam,-2,1.6,-5 RotateEntity cam,10,-20,0 lig = CreateLight() pyra=CreateMesh() surf=CreateSurface(pyra) v1=AddVertex(surf,-1,0,1,1,1) v2=AddVertex(surf,1,0,1,1,1) v3=AddVertex(surf,-1,0,-1,1,1) v4=AddVertex(surf,1,0,-1,1,1) v5=AddVertex(surf,0,2,0,1,1) For v = 1 To CountVertices(surf) VertexColor surf,v,0,255,0 Next t1=AddTriangle(surf,v1,v3,v2) t2=AddTriangle(surf,v4,v2,v3) t3=AddTriangle(surf,v3,v5,v4) t4=AddTriangle(surf,v1,v5,v3) t5=AddTriangle(surf,v2,v5,v1) t6=AddTriangle(surf,v4,v5,v2) UpdateNormals pyra While Not KeyDown(1) x#=x+1 TurnEntity pyra,Cos(x),Sin(x),0 UpdateWorld RenderWorld Text 0,0,Cos(x) Text 0,20,Sin(x) Flip Wend End |
| ||
You need to set the entityfx flag to 2 to see the vertex colours. Stevie |
| ||
Woo thanks |