]> git.cameronkatri.com Git - gmtk-gamejam.git/commitdiff
Shot stuff
authorCameron Katri <me@cameronkatri.com>
Sat, 12 Jun 2021 20:58:09 +0000 (16:58 -0400)
committerCameron Katri <me@cameronkatri.com>
Sat, 12 Jun 2021 20:58:09 +0000 (16:58 -0400)
Assets/Scripts/Controllers/Ball.cs

index b09b1be5452d4832f9c0d3186e721e97e8cc0370..fa9c25197f95350d23df5fc0313d87313238855e 100644 (file)
@@ -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);
     }
   }
 }