Tuesday, September 20, 2011

The Level Editor


I’m pretty sure you have to make a level editor when you make a tiled game. You can’t manually write what each tile is in the code for each room, that would take forever. So when I make a tile based game, I make a level editor.

The tools are right there on the bottom. Hand moves the room around so you can have a large map and not need to see the whole thing the whole time. The pencil tool changes tiles you click on to whatever texture you have selected. The eyedropper is an easy way to select a texture right on the editor without having to go through all the textures. The Fill bucket isn’t working right now so ignore that. G centers the map in case you get lost.

To the left are the layers. Layer 4 is for all the base tiles, Layer 3 is another layer just for sprites with transparency. That way you can stack combinations of sprites which multiplies the variation of tiles. Layer 2 and Layer 1 are going to have to do with collision detection, depth, and special sprites like doors and treasure chests. I haven’t coded those yet.

As you can see, the textures themselves are all vector based. The problem with Flash and vector sprites is that they can look a little blurry. To avoid that make sure every rectangle is on an integer for its x and y values, and that its width and height are integers too.


And that goes for sprite games ESPECIALLY. If you are making a sprite game I’d go ahead and make sure every goddamned little pixel is on integers and is a whole number tall by a whole number wide. A good way to make sure you got the integers is by defaulting the movieclip register to the top-left instead of the middle, because if any image is an odd number wide than it’ll have an x-value of 7.5 or something and that’s bad.

Okay that’s enough for this post. In the next one I’ll get cracking on some of this code.

No comments:

Post a Comment