Hello,
I’ve got a “tapToJump” script that works when i attach it directly to my character sprite, but when I attach it to a gameObject that contains my character sprite it doesn’t work anymore, well it does a lot of nonsense things.
I don’t think the problem is in my code, you can check if you want,
So if you have any clues that could help me, I would be grateful ! Can I attach my script to a game object that contains my character to be able to move him ?
Here’s my code, and also how can I put the code in a bbcode for codes ?
private void FixedUpdate()
{
grounded = Physics2D.OverlapCircle(groundCheck.position,
groundCheckRadius, whatIsGround);
}
void Update () {
if (grounded)
doubleJump = false;
if ((Input.touchCount == 1 && grounded) || (Input.touchCount == 1 && !grounded && !doubleJump))
{
if (Input.GetTouch(0).phase == TouchPhase.Began)
{
GetComponent().velocity = new Vector2(
GetComponent().velocity.x, jump);
doubleJump = true;
}
grounded = false;
}
}