- Home /
Advancing through scene elements?
Hello, I want to have the player click to advance some elements in my scene, but how do I have the functions load one after the other? In my bowling game, the player advances the game flow works like this
:players use arrows the determine the balls starting horizontal position, click to advance :The ball rotates back and forth to determine its angle, click to stop it and advance :A rebounding meter appears to determine the balls velocity, click to set it and throw the ball.
How can I call the different GUI elements and make sure things come up in the correct order?
Answer by StephanK · Nov 26, 2010 at 09:21 AM
Try something like this (untested example code):
int state = 0;
void OnGUI()
{
switch(state) {
case 0:
MoveBall();
break;
case 1:
DetermineAngle();
break;
case 2:
DetermineVelocity();
break;
}
}
in the functions you should then check for input and if the user is done and do state++.