map:create_dynamic_tile() - documentation correction

Started by Realguigui, January 21, 2017, 06:03:30 PM

Previous topic - Next topic
Hello.

After trying the function map:create_dynamic_tile() with the help of the documentation, it seems that the name of the key in the table "properties" that indicated the name of the pattern is "pattern" and not "tile_pattern_id".

Code with wrong key
Code (lua) Select
local dt_lava = {["name"]="test_lave",["layer"]=1,["x"]=320,["y"]=336,["width"]=32,["height"]=32,["tile_pattern_id"]="lava",["enabled_at_start"]=true}

local dt_test = map:create_dynamic_tile(dt_lava)


Debug Console
Info: Simulation started
Error: In on_started: [string "maps/donjon01_01.lua"]:29: bad argument #1 to create_dynamic_tile (Bad field 'pattern' (string expected, got nil))
Info: Simulation finished


Code with the key "pattern"
Code (lua) Select

local dt_lava = {["name"]="test_lave",["layer"]=1,["x"]=320,["y"]=336,["width"]=32,["height"]=32,["pattern"]="lava",["enabled_at_start"]=true}

local dt_test = map:create_dynamic_tile(dt_lava)


No errors and