Question by 
               Damastasam · Sep 23, 2016 at 06:49 PM · 
                2dflip  
              
 
              Fliping a sprite
So im creating a 2d cursor shooter, and the players arm/gun rotates towards the cursor, but it look's really odd because the Character itself does not flip towards the mouse (i dont want it rotating towards it, just a simple left/right flip)
 using UnityEngine;
 using System.Collections;
 
 public class Spriteflip : MonoBehaviour {
 
     public int rotationOffset = 90;
     public Transform target;
     Camera camera;
     private Transform playerScreenPoint= Camera.main.WorldToScreenPoint(player.transform.position);
 
     void Start() {
         camera = GetComponent<Camera>();
     }
 
     // Update is called once per frame
     void  Update (){
         
         if(mouse.x < playerScreenPoint.x) {
             
             Flip()
                 
         } else {
             
             Flip()
                 
         }
 
         private void Flip()
         {
             // Switch the way the player is labelled as facing.
             m_FacingRight = !m_FacingRight;
             
             // Multiply the player's x local scale by -1.
             Vector3 theScale = playerGraphics.localScale;
             theScale.x *= -1;
             playerGraphics.localScale = theScale;
         }
 }
 
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
2D Multiplayer Character Flip 0 Answers
Sprite 2D Flip issue 1 Answer
2D Sprite doesn't flip across pivot point. 0 Answers
Weird bug about flipX being stuck 2 Answers
The object is incorrectly flipped. 0 Answers