Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

rotate player unity 2d left and right

//Rotate player 2D Left and Right
static Vector3 EscalaOriginal;

static Vector3 NovaEscala;

void Start(){

 EscalaOriginal = gameobject.transform.localScale;
 NovaEscala = new Vector3(-0.5f, EscalaOriginal.y, EscalaOriginal.z);
}

 void FixedUpdate()
    {
        //float horizontal = Input.GetAxis("Horizontal");

        //HandleMovement (horizontal); //Movement

        if (gameobject.transform.localScale != NovaEscala)
        {
            if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
            {
                gameobject.transform.localScale = NovaEscala;
            }
        }

        if (gameobject.transform.localScale != EscalaOriginal)
        {
            if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
            {
                gameobject.transform.localScale = EscalaOriginal;
            }
        }
    }
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# console header 
Csharp :: c# move files from one folder to another 
Csharp :: scenemanager.loadscene 
Csharp :: c# create list with range 
Csharp :: c-sharp - get current page url/path/host 
Csharp :: c# unity 
Csharp :: unity stop animation from playing at start 
Csharp :: wpf c# select folder path 
Csharp :: c# consuming post rest service 
Csharp :: how add text to element in javascript 
Csharp :: c# adding to a list 
Csharp :: Minimize window to system tray c# 
Csharp :: c# datagridview hide row selector 
Csharp :: callback function on animation end unity 
Csharp :: c# run cmd hidden 
Csharp :: how to add a gameobject 
Csharp :: project mongodb c# 
Csharp :: c# how to find character in string 
Csharp :: play sound in unity c# 
Csharp :: c# see if string is int 
Csharp :: c# remove first line from textbox 
Csharp :: c# multi assignment 
Csharp :: The entity type has multiple properties with the [Key] attribute. 
Csharp :: delete the particular line in files in c# 
Csharp :: top level statements c# 
Csharp :: how to get total scenes unity 
Csharp :: datetime empty date 
Csharp :: c# file watcher 
Csharp :: c# right function 
Csharp :: c# mongodb get all documents 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =