Hi all, i’m about 1 month on unity course but still didn’t understand about this part:
void update ()
{
if (!hasStarted != true)
{
LockBallToPaddle();
LaunchOnMouseClick();
}
}
private void LaunchOnMouseClick()
{
if(Input.GetMouseButtonDown(0)
{
hasStarted = true;
GetComponent<Rigidbody2D>().velocity = new Vector2(transform.position.x , transform.position.y);
transform.position = paddlePos + paddleToBallVector;
}
}
on that course thats described that if hasStarted are false it will lock the ball and if hasStarted is true it will run the ball or running LaunchOnMouseClick() method.
How can be like that? still didn’t get it because that update method only include if (!hasStarted) how can LaunchOnMouseClick() can be run on void Update?
Thanks in advance…