function map1_off_right() -- Because this script gets triggered within the CharacterSystem's tick method, -- if we immediately cleared out the entities from the old map, we might end up -- returning there and processing stale data. This yield here ensures that we -- are no longer in the CharacterSystem, because processing gets picked back up -- in the ScriptSystem. coroutine.yield() loadMap("../res/maps/map2.tmx", "fromLeft") end