if (!active && count > 0) { scr_array_destroy(leaves, count); count = 0; } if (!active || count >= maximum) exit; timer++; if (timer >= rate) { var _width = (cos((count + 6) / 12) * 18) + 4; var _side = round_to_multiple(sin(count / 2) * _width, 2); var _leaf = instance_create(x + _side, y - round_to_multiple(count, 2), obj_bush_leaf); leaves[count] = _leaf; count++; timer = 0; _leaf.depth = depth - count; if (rate <= 0) { _leaf = instance_create(x - _side, y - round_to_multiple(count, 2), obj_bush_leaf); leaves[count] = _leaf; count++; _leaf.depth = depth - count; } spawner += rate; rate = lerp(max_rate, 0, scr_ease_in(spawner / 30, 2)); }