Mario game for fun

using UnityEngine;

public class MarioController : MonoBehaviour
{
public float moveSpeed = 5f;
public float jumpForce = 10f;
private Rigidbody2D rb;
private bool isGrounded;

void Start()
{
    rb = GetComponent<Rigidbody2D>();
}

void Update()
{
    Move();
    Jump();
}

void Move()
{
    float moveInput = Input.GetAxis("Horizontal");
    rb.velocity = new Vector2(moveInput * moveSpeed, rb.velocity.y);
}

void Jump()
{
    if (isGrounded && Input.GetButtonDown("Jump"))
    {
        rb.AddForce(new Vector2(0f, jumpForce), ForceMode2D.Impulse);
    }
}

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Ground"))
    {
        isGrounded = true;
    }
}

private void OnCollisionExit2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Ground"))
    {
        isGrounded = false;
    }
}

}
using UnityEngine;

public class Coin : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.CompareTag(“Player”))
{
// Ajoute une pièce au score (à implémenter dans un gestionnaire de score)
ScoreManager.Instance.AddScore(1);
Destroy(gameObject);
}
}
}
using UnityEngine;

public class Goomba : MonoBehaviour
{
public float moveSpeed = 2f;
private bool movingRight = true;

void Update()
{
    Move();
}

void Move()
{
    if (movingRight)
    {
        transform.Translate(Vector2.right * moveSpeed * Time.deltaTime);
    }
    else
    {
        transform.Translate(Vector2.left * moveSpeed * Time.deltaTime);
    }
}

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Wall"))
    {
        movingRight = !movingRight; // Change de direction
    }
}

}
using UnityEngine;
using UnityEngine.UI;

public class ScoreManager : MonoBehaviour
{
public static ScoreManager Instance;
public int score;
public Text scoreText;

private void Awake()
{
    Instance = this;
}

public void AddScore(int points)
{
    score += points;
    scoreText.text = "Score: " + score;
}

}

You’ll want to edit that a little so the code is formatter correctly, and probably talk a little bit about it because as just a code-paste it’s not particularly exciting =)