diff options
author | Cameron Katri <me@cameronkatri.com> | 2021-06-12 16:58:09 -0400 |
---|---|---|
committer | Cameron Katri <me@cameronkatri.com> | 2021-06-12 16:58:09 -0400 |
commit | 1cb76b1aa4ef16a91c3847fd5f55aedaa5e83d82 (patch) | |
tree | 934d77d445e156d7478a04e6c88e4ec10373b9c7 /Assets/Scripts/Controllers/Ball.cs | |
parent | 2da4072647dbf8577f8a5e2391551fbbfceef231 (diff) | |
download | gmtk-gamejam-1cb76b1aa4ef16a91c3847fd5f55aedaa5e83d82.tar.gz gmtk-gamejam-1cb76b1aa4ef16a91c3847fd5f55aedaa5e83d82.tar.zst gmtk-gamejam-1cb76b1aa4ef16a91c3847fd5f55aedaa5e83d82.zip |
Shot stuff
Diffstat (limited to 'Assets/Scripts/Controllers/Ball.cs')
-rw-r--r-- | Assets/Scripts/Controllers/Ball.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Assets/Scripts/Controllers/Ball.cs b/Assets/Scripts/Controllers/Ball.cs index b09b1be..fa9c251 100644 --- a/Assets/Scripts/Controllers/Ball.cs +++ b/Assets/Scripts/Controllers/Ball.cs @@ -1,4 +1,5 @@ using System; +using System.Net.Mime; using UnityEngine; namespace Controllers @@ -18,7 +19,10 @@ namespace Controllers public void Shoot(Transform playerTransform) { - GetComponent<Rigidbody2D>().AddForce((Vector2)(playerTransform.right + playerTransform.up) * shotForce); + transform.right = (controller.PlayerHoop.transform.position - transform.position); + var rigidbody = GetComponent<Rigidbody2D>(); + rigidbody.velocity = Vector2.zero; + rigidbody.AddForce(transform.right * shotForce); } } } |