My code only makes the sprite rotate and not the objects attached to a player, can i get some help to make the whole char rotate without flipping the camera
Here is the code `public Animator animator;
Rigidbody2D rg2d;
SpriteRenderer spriteRenderer;
public float runspeed = 8f;
public float jumpforce = 18f;
bool isGrounded;
[SerializeField]
Transform groundCheck;
[SerializeField]
Transform groundCheck2;
[SerializeField]
Transform groundCheck3;
void Start()
{
animator = GetComponent();
rg2d = GetComponent();
spriteRenderer = GetComponent();
}
private void FixedUpdate()
{
if ((Physics2D.Linecast(transform.position, groundCheck.position, 1 << LayerMask.NameToLayer("Ground"))) ||
(Physics2D.Linecast(transform.position, groundCheck2.position, 1 << LayerMask.NameToLayer("Ground"))) ||
(Physics2D.Linecast(transform.position, groundCheck3.position, 1 << LayerMask.NameToLayer("Ground"))))
{ isGrounded = true; animator.SetBool("Jumping", false); }
else { isGrounded = false;animator.SetBool("Jumping", true);
}
if (Input.GetKey("d"))
{
rg2d.velocity = new Vector2(runspeed, rg2d.velocity.y);
spriteRenderer.flipX = false;
}
else if (Input.GetKey("a"))
{
rg2d.velocity = new Vector2(-(runspeed), rg2d.velocity.y);
spriteRenderer.flipX = true;
}
else
{
rg2d.velocity = new Vector2(0, rg2d.velocity.y);
}
if (Input.GetKey("space") && isGrounded)
{
rg2d.velocity = new Vector2(rg2d.velocity.x, jumpforce);
}
animator.SetFloat("Speed",Mathf.Abs(rg2d.velocity.x));
if (Input.GetKeyDown("q") && isGrounded)
{ animator.SetBool("Attack", true); }
else animator.SetBool("Attack", false);`