Hi.
I have some code that checks if the player is touching the screen, then if he’s touching withing an area, set -Jump to true and if not, set it to false.
This is the code:
if(Input.touchCount > 0)
{
foreach (Touch touch in Input.touches)
{
Vector3 inputGuiPosition = touch.position;
inputGuiPosition.y = Screen.height - inputGuiPosition.y;
if(inputGuiPosition.x > Screen.width / 5)
{
_jump = true;
}
else if(_jump == true)
{
_jump = false;
}
}
}
When I touch the screen in the right side, and let go, the player keeps jumping.
When I souch the screen in the left side, while the player is jumping, he stops jumping
I’m guessing the problem is something the _jump is only set to false, if the player touches somewhere else on the screen.
If that is the case, how do I fix it?
Thanks for reading
-Frank