1 #summary Drawing maps with Lua. |
1 #summary Drawing maps with Lua. |
2 |
2 |
3 = Drawing Maps With Lua (OUTDATED) = |
3 = Drawing maps with Lua (OUTDATED) = |
4 |
4 |
|
5 == Overview == |
5 Starting in 0.9.18 it is possible to reliably use drawn map mode to draw maps with scripts. |
6 Starting in 0.9.18 it is possible to reliably use drawn map mode to draw maps with scripts. |
6 A simple example is given below. Note that Drawn maps use an area of 4096x2048. The examples below are static, but obviously this could be used for a random map variation - for example, simulating the Cave map by doing the fill below, then drawing random tunnels using circles that shift their course smoothly. |
7 A simple example is given below. Note that Drawn maps use an area of 4096x2048. The examples below are static, but obviously this could be used for a random map variation - for example, simulating the Cave map by doing the fill below, then drawing random tunnels using circles that shift their course smoothly. |
7 |
8 |
8 = Details = |
9 == Details == |
9 |
|
10 First, a couple of convenience functions for drawing to the map. |
10 First, a couple of convenience functions for drawing to the map. |
11 <code lang="lua"> |
11 <code lang="lua"> |
12 PointsBuffer = '' -- A string to accumulate points in |
12 PointsBuffer = '' -- A string to accumulate points in |
13 function AddPoint(x, y, width, erase) |
13 function AddPoint(x, y, width, erase) |
14 PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) |
14 PointsBuffer = PointsBuffer .. string.char(band(x,0xff00) / 256 , band(x,0xff) , band(y,0xff00) / 256 , band(y,0xff)) |