Version: Solarus 1.5.3
OS: Linux
This might be a bug?
I tried using door:on_opened() (http://www.solarus-games.org/doc/latest/lua_api_door.html#lua_api_door_on_opened), but it seems to not be working. I double checked the name and everything. This function is called during an opening of a door, right?
function door_1:on_opened()
print("opened door")
hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
end
The same occurred with door:is_open() (http://www.solarus-games.org/doc/latest/lua_api_door.html#lua_api_door_is_open). The door is indeed open, but nothing happens.
sol.timer.start(1000, function()
if door_1:is_open() == true then
hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
end
return true
end)
The function door:is_opening() (http://www.solarus-games.org/doc/latest/lua_api_door.html#lua_api_door_is_opening)worked.
sol.timer.start(1000, function()
if door_1:is_opening() == true then
hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
end
return true
end)
So, I tried to reproduce your error and couldn't. My code:
function basement_door:on_opened()
print("no problems here")
end
That worked fine, so maybe it's an issue with Solarus 1.5.3? I'm running 1.5.1. That or you actually do have a typo in your door entity's name on the map. Just to cover all the bases, it is a door entity, right? Sometimes I use NPCs as doors and just set them disabled whenever I need the door open, but that would never call door:on_opened().
I am pretty sure. Here is an image to prove it. I made sure all the animations existed as stated in the documentation (http://www.solarus-games.org/doc/latest/lua_api_door.html#lua_api_door_overview).
(https://s22.postimg.cc/3md11qeap/Edit_an_entity_001.png)
Also, I mentioned the function door:is_opening() (http://www.solarus-games.org/doc/latest/lua_api_door.html#lua_api_door_is_opening)working.
sol.timer.start(1000, function()
if door_1:is_opening() == true then
hero:teleport("chain_village/underground_miniboss", "boss_destination", "fade")
end
return true
end)
Does the animation "opening" of your door sprite correctly ends? Because if it loops, that might explain that the opening state never finishes.
@Christopho
No loop, but it seems the "opening" frame delay was the problem. The frame delay was at: 0 ms
It works now. Thank you Christopho!
Indeed, a delay of 0 means to loop forever.