Hey guys!
I’m trying to program a game similar to Doodle Jump. Everything works except that a certain platform is not working properly. I can jump on it but I can’t jump through below, I always have to jump around the platform. Can you help me?
here is my script:
public class Springer : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.GetComponent().velocity.y <= 0)
{
collision.gameObject.GetComponent().AddForce(Vector3.up * 1000f);
}else
{
if (collision.gameObject.GetComponent().velocity.y > 0)
{
collision.gameObject.GetComponent().velocity = new Vector2(0.0f, 10f);
Debug.Log(“colisione xD”);
}
}
}
}