So I want to use Among Us characters I would make them in to pixel art would this be alright?
Odyssey Coder
Recent community posts
Alright I put everything in and my code now looks like this (Sorry for being pane in butt I am dummy with barely any C# knowledge)
using UnityEngine;
public class CharacterController : MonoBehaviour
{
public float MovementSpeed = 1;
private Rigidbody2D _rigidbody;
private void Start()
{
_rigidbody = GetComponent<Rigidbody2D>();
}
private void Update()
{
var movement = Input.GetAxis("Horizontal");
_rigidbody.AddForce(new Vector3(movement, 0, 0) * Time.deltaTime * MovementSpeed);
transform.Translate(Input.GetAxis("Horizontal") * 15f * Time.deltaTime, 0f, 0f);
if (Input.GetAxis("Horizontal") < 0)
{
transform.rotation *= Quaternion.eulerAngles(0, 0, 10);
}
if (Input.GetAxis("Horizontal") > 0)
{
transform.rotation *= Quaternion.eulerAngles(0, 0, -10);
}
}
}
I now get the error Quarternion.eulerAngles cannot be used like a method. Error code CS1955
I am trying to add rotation to my player and he keeps during wide and I do not know how to fix. Does anyone know.
My Script:
using UnityEngine;
public class CharacterController : MonoBehaviour
{
public float MovementSpeed = 1;
private Rigidbody2D _rigidbody;
private void Start()
{
_rigidbody = GetComponent<Rigidbody2D>();
}
private void Update()
{
var movement = Input.GetAxis("Horizontal");
transform.position += new Vector3(movement, 0, 0) * Time.deltaTime * MovementSpeed;
transform.Translate(Input.GetAxis("Horizontal")* 15f * Time.deltaTime, 0f, 0f);
Vector3 characterScale = transform.localScale;
if (Input.GetAxis("Horizontal") < 0)
{
characterScale.x = -10;
}
if (Input.GetAxis("Horizontal") > 0)
{
characterScale.x = 10;
}
transform.localScale = characterScale;
}
}