diff --git a/Assets/Sword.cs b/Assets/Sword.cs new file mode 100644 index 0000000..daab4be --- /dev/null +++ b/Assets/Sword.cs @@ -0,0 +1,23 @@ +using UnityEngine; + +public class Sword : MonoBehaviour +{ + // Start is called once before the first execution of Update after the MonoBehaviour is created + void Start() + { + + } + + // Update is called once per frame + void Update() + { + transform.rotation = Quaternion.Euler( + new Vector3 (0, 0, Mathf.Atan2( + Screen.height/2 - Input.mousePosition.y, + Screen.width/2 - Input.mousePosition.x + ) * Mathf.Rad2Deg + 135) + ); + } + void Swing() { + } +} diff --git a/README.md b/README.md index 4d1fced..a10f819 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ - [x] Health - [x] Enemy takes health when touches - [ ] Enemy health bar -- [ ] Sword that points to mouse cursor +- [x] Sword that points to mouse cursor - [ ] Sword swings when click - [ ] Sword damages enemies in swing area - [ ] Wave spawns enemies