add level transition function