if(other.gameObject.name == "Waypoint_1"){Should have been:
Waypoint1Col = true;}
if(other.gameObject.name == "Waypoint_1"){
Waypoint2Col = true;}
if(other.gameObject.name == "Waypoint_1"){
Waypoint1Col = true;}
if(other.gameObject.name == "Waypoint_2"){
Waypoint2Col = true;}
That's what happens when you copy and paste code though. I also took this time to update the waypoints so that it doesn't work if you drive the wrong way round the track. New code is written below:
if(other.gameObject.name == "Waypoint_1"){
Waypoint1Col = true;
}
if(other.gameObject.name == "Waypoint_2" && Waypoint1Col == true){
Waypoint2Col = true;}
if(other.gameObject.name == "Waypoint_0" && Waypoint1Col == true && Waypoint2Col == true){
Waypoint0Col = true;}
if(Waypoint0Col == true && Waypoint1Col == true && Waypoint2Col == true){
NoLaps += 1;
Waypoint0Col = false;
Waypoint1Col = false;
Waypoint2Col = false;
}
No comments:
Post a Comment