- Home /
 
               Question by 
               Cryno1000 · Jan 12, 2020 at 08:53 PM · 
                movementspriteif-statements  
              
 
              Changing sprite depending on movement direction
Hi, I'm making a 2D game where enemies chase the player, but I'm having trouble changing the enemies sprite based on the movement direction. So like if the player is to the right of the enemy, I want to change the sprite to moving_right.
So like
 // if player is to right of enemy {
         this.gameObject.GetComponent<SpriteRenderer>().sprite = moving_right;
 }
Thanks in advance!
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                