Okay so I really don’t understand why the hasStarted thing works in our code.
So I’m declaring in the Start method that hasStarted is false.
In the Update method I’m saying by
void Update()
{
if (hasStarted == false)
{
LockBalltoPaddle();
LaunchOnMouseClick();
}
}
that because hasStarted is false do LockBallToPaddle() and LaunchOnMouseClick() as well. So it’s trying to do both of them but it always locks the ball to the paddle so it won’t launch. Why don’t I need something like this?
void Update()
{
if (hasStarted == false)
{
LockBalltoPaddle();
}
else LaunchOnMouseClick();
}
I know that we’re declaring in the LaunchOnMouseClick method that hasStarted is now true, but why does it make the code work? It might be just that I’m tired but I can’t figure it out and it makes me crazy…
Thanks in advance.
EDIT: So to wrap my question up we tell the game what to do if hasStarted is false but we never tell it what to do if it’s true, we just declare it is true in LaunchOnMouseClick() yet it still launches the ball… I don’t get it.