]> git.cameronkatri.com Git - gmtk-gamejam.git/commitdiff
Improve checking of shot
authorCameron Katri <me@cameronkatri.com>
Sun, 13 Jun 2021 04:11:07 +0000 (00:11 -0400)
committerCameron Katri <me@cameronkatri.com>
Sun, 13 Jun 2021 04:11:07 +0000 (00:11 -0400)
Assets/Prefabs/Hoop.prefab
Assets/Scripts/Controllers/Hoop.cs

index a16593810bb4250ac062100ec7e2b1bc1315fce9..d48bbadc28d80c1dff57312bfcec690a6ba19d36 100644 (file)
@@ -252,8 +252,8 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 40e5d6a883d14c7fb60913ec2fc3009c, type: 3}
   m_Name: 
   m_EditorClassIdentifier: 
-  Rim: {fileID: 2639737386686648195}
-  Net: {fileID: 1029364543094105199}
+  Rim: {fileID: 1029364543094105199}
+  Net: {fileID: 2639737386686648195}
   shotSound: {fileID: 5401724803266703353}
   crowdSound: {fileID: 9185251669550473948}
 --- !u!82 &5401724803266703353
index 7e924e72ba608c0c76d9a76bf04fbe49ecff1e00..488c38b9b4eef989847742359eb3ff4b81270fe8 100644 (file)
@@ -22,7 +22,8 @@ namespace Controllers
                {
                        if (other.GetComponent<Ball>() == null) return;
 
-                       if (Rim.IsTouching(other) && Net.IsTouching(other))
+                       // We don't want people shooting up the hoop so check the velocity of the ball to make sure it is going down.
+                       if (Rim.IsTouching(other) && Net.IsTouching(other) && (other.GetComponent<Rigidbody2D>().velocity.y < 0))
                        {
                                HoopAnimator.Rebind();
                                shotSound.Play();