So I created a ball game where balls go through tubes, and that scores points!
What I want to know is that is there a way for me to create a “block” so that when 6 balls have passed the trigger, the tube closes up so no more balls can go into it?
Here’s how I imagine the code…
The balls themselves have an assigned number… so each balls has the value of “1”
The “blocker” is made invisible (which I can enable false)
When 6 balls pass through the blocker, the blocker activates and enables true (so now no more balls can go into the tube)
So the blue blocks the hole, slides open (left in this case) so a ball can fall into it. When it does, the ball itself blocks the hole until the blue block pushes the ball out towards the collection tray and reblocks the hole. This ensures one ball is dispensed at a time.
The potential problem with turning the blocker on and off is that another ball might occupy the space where the blocker is when you turn it on which causes interesting behaviour (usually physics objects going everywhere).
I tried using a rectangle as some sort of dispenser method for when the ball drops, but then this became problematic when I have 59 balls bouncing everywhere!
The blocker in this case would only be a .1 thickness circle, so if there is problems with physics well then that’s just another adventure to be had!
I had a look at the tutorial you sent me, and will definitely experiment with triggers unfortunately, since I am a newbie when it comes to code, a lot of it is just words to me! But I should definitely have a crack at it!
Originally, I want to set the value of the blocker x = 1
and the values of the balls each have a value of y = 1
If 6 balls past that circle, then the enable = true will happen!
Couldn’t find a tutorial on how to assign values to entities, but will keep looking and experimenting! If you got any ideas, then awesome!
and enter the number value in! (That makes my job a hell of a lot easier!)
Will label them as such and will look up the GUI tutorials on PlayCanvas so when the number has gone into a tube, you’ll see the number on the screen! That will be the next step!