Create an elevator entity
In order to let Rachel walk above and below a bridge, a lot of effort is required. This bridge for example:
Last time I wanted something like this I had to create 2 sensors and an invisible platform between them to elevate and lower Rachel at the proper times. Here's what that looks like:
do
local sensor = map:get_entity("bridge_1")
function sensor:on_activated()
local x, y, z = hero:get_position()
hero:set_position(x, y, 1)
log("Hero moved to L1: ", hero:get_position())
end
end
do
local sensor = map:get_entity("bridge_2")
function sensor:on_activated()
local x, y, z = hero:get_position()
hero:set_position(x, y, 0)
log("Hero moved to L0: ", hero:get_position())
end
end
Rather than needing to use 3 map entities, I'd like to have a single elevator
custom entity. This custom entity would either create the other 3 needed entities on started, or use some other method to lift the hero without her falling down.
Lots more background (including screenshots): http://forum.solarus-games.org/index.php/topic,1278.0.html
The goal is to use 1 custom entity to solve this.