aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorCameron Katri <me@cameronkatri.com>2021-06-13 00:11:07 -0400
committerCameron Katri <me@cameronkatri.com>2021-06-13 00:11:07 -0400
commit25192f07018ad142818a87c2aacac1bf0ecdf551 (patch)
tree72482c571f81a4183d3236cf03ef4b0bfeedf92a
parent20e5bf4339ffe52b6b09c7b72413c1e2295e282a (diff)
downloadgmtk-gamejam-25192f07018ad142818a87c2aacac1bf0ecdf551.tar.gz
gmtk-gamejam-25192f07018ad142818a87c2aacac1bf0ecdf551.tar.zst
gmtk-gamejam-25192f07018ad142818a87c2aacac1bf0ecdf551.zip
Improve checking of shot
-rw-r--r--Assets/Prefabs/Hoop.prefab4
-rw-r--r--Assets/Scripts/Controllers/Hoop.cs3
2 files changed, 4 insertions, 3 deletions
diff --git a/Assets/Prefabs/Hoop.prefab b/Assets/Prefabs/Hoop.prefab
index a165938..d48bbad 100644
--- a/Assets/Prefabs/Hoop.prefab
+++ b/Assets/Prefabs/Hoop.prefab
@@ -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
diff --git a/Assets/Scripts/Controllers/Hoop.cs b/Assets/Scripts/Controllers/Hoop.cs
index 7e924e7..488c38b 100644
--- a/Assets/Scripts/Controllers/Hoop.cs
+++ b/Assets/Scripts/Controllers/Hoop.cs
@@ -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();