Author Topic: How do you make a proper basketball hoop?  (Read 2622 times)

So I've been trying for a little while now to make a basketball hoop. When the player makes a basket, a bottom print message pops up to all players in the minigame. That's it. Pretty simple.

Problem is, I'm not sure how to make it work in a way that a hoop actually would. The way I have it set up now is there is a plate underneath the rim of the hoop. If you hit the plate, it triggers fakekillbrick and the message pops up. There are numerous problems with this. For one, the ball hits it before it "dies", meaning that the ball kind of bounces off of it most of the time. It doesn't go seamlessly through the hoop as it should. Secondly, you can hit the plate from the bottom with a basketball and score a point.

I know people make working hoops all the time, so, my question is, how do you go about it? I'm sure its super easy and I'm just missing something obvious, but help is always nice. Thanks in advance!

Use the onBallHit input event.

Use the onBallHit input event.
Is that a thing?

Anyway, what I would do is use VCE and have 2 plates that trap the ball

This is a hoop vvv

==========   1st plate covering this
#########
 ########
  #######
   ######       2nd plate covering this

The first plate has no raycasting.
When the ball hits the second plate it triggers:
OnProjectileHit > [Self] > IfValue <var:br:LastProj> = Baskeball (not sure if correct name)
0 OnVariableTrue > [Self] > SetRayCasting [ ]
1000 OnVariableTrue > [Self] > SetRayCasting [X]
0 OnVariableTrue > [First Plate] > SetRayCasting [X]
1000 OnVariableTrue > [First Plate] > SetRayCasting [ ]

On the First plate:
OnProjectileHit > [Self] > IfValue <var:br:LastProj> = Baskeball (still not sure if correct name)
OnVariableTrue > Minigame >BottemprintAll "%1 scored a point!"


This should work although I haven't tested it.
It also makes sure the ball isn't thrown upwards.

Is that a thing?

Anyway, what I would do is use VCE and have 2 plates that trap the ball

This is a hoop vvv

==========   1st plate covering this
#########
 ########
  #######
   ######       2nd plate covering this

The first plate has no raycasting.
When the ball hits the second plate it triggers:
OnProjectileHit > [Self] > IfValue <var:br:LastProj> = Baskeball (not sure if correct name)
0 OnVariableTrue > [Self] > SetRayCasting [ ]
1000 OnVariableTrue > [Self] > SetRayCasting [X]
0 OnVariableTrue > [First Plate] > SetRayCasting [X]
1000 OnVariableTrue > [First Plate] > SetRayCasting [ ]

On the First plate:
OnProjectileHit > [Self] > IfValue <var:br:LastProj> = Baskeball (still not sure if correct name)
OnVariableTrue > Minigame >BottemprintAll "%1 scored a point!"


This should work although I haven't tested it.
It also makes sure the ball isn't thrown upwards.

2muchwork

All you need is two plates stacked ontop of each other.  Both have no collision nor rendering, but do have raycasting enabled.  The top one had this for events:

Code: [Select]

Sorry about that.  Windows phone is somewhat glitchy.

anyway, these are the events

Code: [Select]

I swear to god, what the hell.

Switched to computer, here are the events:

Brickname = Top
Code: [Select]
[0] [x] [0] [OnBallHit] [Ball] [Delete]
[1] [x] [0] [OnBallHit] [NamedBrick]>[Bottom] [SpawnProjectile] [BallBasketball]
[2] [x] [0] [the rest of the things you need.

you overuse VCE so much when there are simpler ways , even if it's exactly as you say but without VCE

Ah, thanks so much guys! These will help alot!

I got even a better idea, and I tested it.

Just one plate with:
[200] OnBallHit > Ball > Redirect 0 0 0
  • OnBallHit > Self > SetRaycasting [ ]
  • [2000] OnBallHit > Self > SetRaycasting
[X]

It stops the ball on hit in mid air, so it falls back down.
You can even make it [0 0 -5] so the ball gets velocity down

I got even a better idea, and I tested it.

Just one plate with:
[200] OnBallHit > Ball > Redirect 0 0 0
  • OnBallHit > Self > SetRaycasting [ ]
  • [2000] OnBallHit > Self > SetRaycasting
[X]

It stops the ball on hit in mid air, so it falls back down.
You can even make it [0 0 -5] so the ball gets velocity down

The issue with that is the direction in which the ball can hit the plate.

The issue with that is the direction in which the ball can hit the plate.

That's why you put it in the middle of your basketball hoop, and put a plate under it that turns off raycast when the top is hit.

That's why you put it in the middle of your basketball hoop, and put a plate under it that turns off raycast when the top is hit.

but then you rely on timing for everything to work.

but then you rely on timing for everything to work.

No you don't? Having raycasting off for two seconds wont cause any issues, and if you have a ball going in faster than two seconds each, there's a problem.

No you don't? Having raycasting off for two seconds wont cause any issues, and if you have a ball going in faster than two seconds each, there's a problem.

I guess it's just not my style to use delays for stuff like this.  I prefer things to happen in segments, rather than in a long chain of events - i.e. something causes an effect, and that effect triggers something else to happen, which makes another thing do something, rather than something causes an effect, which 5 seconds later does another thing, then 2 seconds later another thing happens.

The former style just seems sturdier to me.