LuaDrawing.wiki
changeset 743 d22bb25c55ac
parent 597 654a9b9b6aa5
child 1388 23cc8581c0da
equal deleted inserted replaced
742:1ece82f7b547 743:d22bb25c55ac
     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))