1st Unity project. I (I imagine) changed something without intention, and my player no longer jumps… it prints “jump” before and after the Addforce command, and the tag and bool “isfeet” is correctly setup
. Thanks in advance for the help
using JetBrains.Annotations;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IntroductionCSharp : MonoBehaviour
{
public string pnjname;
public float speed;
public float powerJump = 2f;
public PlayerFeet feet;
// Start is called before the first frame update
void Start()
{
Debug.Log("hello");
}
// Update is called once per frame
void Update()
{
Vector2 currentVelocity = new Vector2(0, GetComponent<Rigidbody2D>().velocity.y);
if (Input.GetKey(KeyCode.Q))
{
currentVelocity.x -= speed;
}
else if (Input.GetKey(KeyCode.D))
{
currentVelocity.x += speed;
}
GetComponent<Rigidbody2D>().velocity = currentVelocity;
//saut
if (Input.GetKeyDown(KeyCode.Space) && (feet.isGrounded))
{
Debug.Log("jump");
GetComponent<Rigidbody2D>().AddForce(Vector2.up*powerJump);
Debug.Log("la c'est bon j'ai jump");
}
}
}

What is the powerJump value as shown in the Inspector?
– ArachnidAnimalIt looks like it should work, maybe the powerJump is 0 for some reason? Also try caching the rigidbody and not looking for it every time. I can also recommend to tidy up the project by having Environment as a parent and assigning the spikes and stuff as children.
– Tidali