I made a path follow 2d for a Racing game And what I want is when the “Bot” finishes the lap first than the Player that it shows a You Lose screen, But if the player wins it shows a You win Screen. Can anyone help? My code so far:
Changing to a different screen, depending on who won
For the first two parts, I suggest creating an Area2D at the finish line, giving it a script, and connecting the body_entered and/or area_entered signals to a method in that script. If your player is a CharacterBody2D, for example, then it should trigger body_entered.
I don’t know how your bot is constructed, other than it uses a PathFollow2D - if there’s some kind of physics body in there, it should also trigger a body_entered signal from the Area2D, otherwise you could attach an Area2D to it to trigger the area_entered signal instead… or you could simply use the progress_ratio - if that gets to 1 or above, that means the bot is at the finish line, right?