I have trying for ages now, i have been looking through all the answers and different websites but all of the fixes are just giving me random compile errors.
I have so nearly finished my game all i have to do is fix this one last things then i am done.
Is there anyway i can fix it without importing assets?
heres my code (btw my camera is a child of the player(and yes i have tried unparenting it and adding a script))
if(Input.GetKey(KeyCode.D))
{
rigidbody2D.velocity = new Vector2 (speed, rigidbody2D.velocity.y);
transform.eulerAngles = new Vector2(0, 0);
}
else if(Input.GetKey(KeyCode.A))
{
rigidbody2D.velocity = new Vector2 (speed*-1, rigidbody2D.velocity.y);
transform.eulerAngles = new Vector2(0, 180);
}
thanks for the help and being patient enough to read this!
EDIT---------------------------------------------------------------------------------------------
I tried this:
if(Input.GetKey(KeyCode.D))
{
rigidbody2D.velocity = new Vector2 (speed, rigidbody2D.velocity.y);
transform.eulerAngles = new Vector2(0, 0);
camera.transform.eulerAngles = new Vector2(0,0);
}
else if(Input.GetKey(KeyCode.A))
{
rigidbody2D.velocity = new Vector2 (speed*-1, rigidbody2D.velocity.y);
transform.eulerAngles = new Vector2(0, 180);
camera.transform.eulerAngles = new Vector2(0,0);
}
And it kind of worked, the camera stays where it should and doesn’t rotate but
when the player moves to the left the whole world disappear except the background, why is this happening?
Thanks again!
I solved it!