Ahmet Efe11
Picopat
- Katılım
- 18 Ağustos 2023
- Mesajlar
- 41
Daha fazla
- Cinsiyet
- Erkek
C#:
using System.Runtime.CompilerServices;
using UnityEngine;
public class chatgpt : MonoBehaviour.
{
public float moveSpeed = 5f;
public float jumpForce = 10f;
private bool isGrounded;
private Rigidbody rb;
public Animator animator;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
// Karakterin yere değip değmediğini kontrol etmek için Raycast kullanıyoruz.
isGrounded = Physics.Raycast(transform.position, Vector3.down, 1.1f);
// Yatay hareket.
float horizontalInput = Input.GetAxis("Horizontal");
Vector3 movement = new Vector3(horizontalInput, 0f, 0f) * moveSpeed * Time.deltaTime;
transform.Translate(movement);
animator.SetFloat("speed", Input.GetAxis("Horizontal"));
// Zıplama.
if (isGrounded && Input.GetButtonDown("Jump"))
{
rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
animator.SetBool("IsJumping", true);
}
}
}
kodunu yazdım ve Assets\script\chat gpt.cs(38,24): error CS1002: ; expected
Hatasını verdi ne yapabilirim?