Solarus-Games English Forum

Solarus => Bugs & Feature requests => Topic started by: Realguigui on January 21, 2017, 06:03:30 PM

Title: map:create_dynamic_tile() - documentation correction
Post by: Realguigui on January 21, 2017, 06:03:30 PM
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 (https://drive.google.com/uc?export=download&id=13x7TjoYFE4ecQrdXSTnGANfas3nlbclqRQ)
Title: Re: map:create_dynamic_tile() - documentation correction
Post by: Christopho on January 22, 2017, 02:41:22 PM
This is fixed, thanks noticing!