using System.Collections;
using System.Collections.Generic;
using Unity.Jobs;
using UnityEngine;
public class Playercontrler : MonoBehaviour
{
public Rigidbody2D rbp;
public Collider2D cp;
public float speed;
public float jumpforce;
bool jump;
public float isjump;
public LayerMask G;
void Start()
{
}
void FixedUpdate()
{
isjump = Input.GetAxis("Vertical");
jpt();
jpo();
}
void jpo()
{
if(cp.IsTouchingLayers(G))
{
if (isjump==1)
{
rbp.velocity = new Vector2(rbp.velocity.x, jumpforce * Time.deltaTime);
jump = false;
}
isjump = 0;
}
}
void jpt()
{
if(!cp.IsTouchingLayers(G))
{
if(isjump==1)
{
if (!jump)
{
rbp.velocity = new Vector2(rbp.velocity.x, jumpforce * Time.deltaTime);
}
jump = true;
}
isjump = 0;
}
}
}