grofit Posted March 5, 2015 Share Posted March 5, 2015 So I am just prototyping something which is more of a level editor where someone can load a tileset, then draw the level, however one of the requirements is being able to show a grid. Now I watched the example of drawing lines but the mere fact it was within a debug namespace didnt really fill me with confidence that this was the best way to solve the problem. I noticed that there is the BitmapData object which seems like it may be a better fit as I can just blit out the lines on that, however as my level size will be:(level width * tile width) * (level height * tile height)It felt like making a bitmapdata the size of the entire level could be overkill for it, so is there some best way to be able to achieve this? Link to comment Share on other sites More sharing options...
rich Posted March 5, 2015 Share Posted March 5, 2015 Surely the grid only actually needs to be the size of the screen? I mean your world might be massive, but the grid itself is a screen space level object, not a world one I'd suspect. Link to comment Share on other sites More sharing options...
grofit Posted March 5, 2015 Author Share Posted March 5, 2015 I guess I can do it so there is only lines over the screen and offset them as the camera moves around, but that aside I am more interested on what is the recommended practice for achieving the grid. From what I have read the only options seem to be making a rect which is slightly smaller then spacing them out, or doing lines however was wondering if there was some other approach Link to comment Share on other sites More sharing options...
rich Posted March 6, 2015 Share Posted March 6, 2015 Unless it needs to dynamically change I would just use a texture. Or a BitmapData with the grid pre-drawn to it and then texture a Sprite with that. It will always be the fastest way. You could also use a TileSprite and then use tilePosition to scroll it as the map moves. This would be fine in WebGL, a bit slower in Canvas. Link to comment Share on other sites More sharing options...
grofit Posted March 6, 2015 Author Share Posted March 6, 2015 Does need to change in edit mode, the user can alter the level size and the tile size as well as change the tilesets being used. Although from what you say I am already looking in the right direction so thanks for the help. Link to comment Share on other sites More sharing options...
Recommended Posts