Aurus aylol
Ученик
(95),
на голосовании
3 года назад
Хотел сделать 2д персонажу управление по видео, ошибка (31,6): error CS1513: } expected using System.Collections; using System.Collections.Generic; using UnityEngine;
public class hero : MonoBehaviour {
public float horizontalSpeed; float speedX; public float verticalImpulse; Rigidbody2D rb;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class hero : MonoBehaviour {
public float horizontalSpeed;
float speedX;
public float verticalImpulse;
Rigidbody2D rb;
void Start() {
rb = GerComponent();
}
void FixedUpdate () {
if (Input.GetKey(KeyCode.A))
{
speedX = -horizontalSpeed;
}
else if (Input.GetKey(KeyCode.D))
{
speedX = horizontalSpeed;
}
if (Input.GetKeyDown(KeyCode.Space))
{
rb.AddForce(new Vector2(0, verticalImpulse), ForceMode2D.Impulse);
}
transform.Translate(speedX, 0, 0);
speedX = 0;
}