Skip to content

Commit 2e93cb5

Browse files
committed
Fix: Sprite rotation for projectiles
1 parent 2937118 commit 2e93cb5

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Assets/Scripts/Interactive/Catchable/Weapon/RangedWeapon.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,22 @@ public override void Use()
2121

2222
var direction = GetComponentInParent<CharacterController>().VectorDirection;
2323
projectile.transform.position = transform.position + new Vector3(direction.x, direction.y);
24+
switch(GetComponentInParent<CharacterController>().Direction) {
25+
case 1:
26+
projectile.transform.eulerAngles = new Vector3Int(0, 0, 270);
27+
break;
28+
case 2:
29+
projectile.transform.eulerAngles = new Vector3Int(0, 0, 180);
30+
break;
31+
case 3:
32+
projectile.transform.eulerAngles = new Vector3Int(0, 0, 90);
33+
break;
34+
default:
35+
break;
36+
}
2437
var rb = projectile.GetComponent<Rigidbody2D>();
2538
rb.AddForce(direction * ProjectileSpeed);
26-
}
39+
}
2740

2841
}
2942
}

0 commit comments

Comments
 (0)