I've created an action for some entity in the level.
Do you know rez? the game created from sega for dreacast, i want simulate a similar evolution code.
i have this
Code:
if(energy > 100){
			lvl += 1;
			energy = 0;
		}

Code:
action level { //impostare i flag
	my.transparent = ON;
	my.alpha = 0;
	my.ambient = 35;
	gameover_pan.alpha = 0;
	sleep(5);
	while(lvl > 0){
		while(lvl == 1)
		{
			my.alpha -= my.flag2*4*time_step;
			my.x = player.x;
			my.z = player.z;
			my.y = player.y;
				if(my.alpha < 100){
				my.alpha += my.flag1*2*time_step;
				my.alpha -= my.flag2*2*time_step;
				}
		my.pan += 10*my.flag1;
		wait(1);
		}
	while(lvl == 2)
		{
			my.x = player.x;
			my.z = player.z;
			my.y = player.y;
			if(my.alpha < 100){
				my.alpha += my.flag2*2*time_step;
			}
			my.roll += 3*my.flag2;
			wait(1);
		}
	}
	while(my.alpha > 0){
		my.alpha-= 2*time_step;
		wait(1);
	}
	gameover_pan.visible = on; //parte del gameover
	while(gameover_pan.alpha <= 100){
		gameover_pan.alpha += 10 * time_step;
		wait(1);
		}

}

it works when lvl decrase, but not when lvl incrase.
When energy come to 100, lvl pass to 2, then it says endless loop.

Someone can give me an hel? cause it seems fine to me, but doesnt work.


~Vision Divine~