drawing a grid over an array position?
BlitzMax Forums/BlitzMax Beginners Area/drawing a grid over an array position?
| ||
How do I add a selection box around the currently selected tile in my map editor. An example would be selecting the first tile in the top row. When my mouse is over the position how would I add a selection box around the tile. I kindof want the selection box to move tile by tile. heres a quick bit of code that draws my tiles to screen. If somebody can give me a hint or an example of how to do the above I would appreciate it. Function factory() Local x:Int,y:Int Local mapX:Int,mapY:Int Local map[36,22] Local mX:Int,mY:Int mapX = 40 mapY = 40 For x = 0 To 35 For y = 0 To 21 map[x,y] = 1 Next Next Repeat mX = MouseX() my = MouseY() Cls For x = 1 To 35 For y = 1 To 21 If map[x,y] = 1 DrawImage rplat,mapX+(x*20),mapY+(y*20),1 EndIf Next Next Flip Until KeyHit(KEY_ESCAPE) End Function |
| ||
The way I always do that is to just check when rendering, then blit it using the coords the image(Tile) would be drawn to. I.eudeo for for DrawTile if MapX = SelectedX and MapY = SelectedY then RectAroundTile next next |