PDA

View Full Version : Need help with the score board in Rings game


lucyrn99
11-13-2016, 03:43 PM
Hi everyone,

Our assignment is to create a game where a ring drops out of the sky, and the user has to move a cone under the ring, in order to catch it.

The user gets 1 point for each time he/she catches a ring with the cone.
This should repeat/loop 10 times, at which point the game should end.

My difficulty has been with trying to get the scoring to work properly.

I have watched a bunch of youtube videos to learn how to set up the scoring, and have created the numerical variables to designate that the goal of the game is a score = 10. I'm still obviously missing some crucial connection, though, because the scoring is not working at all.

Thanks in advance for any advice, and my code is attached for your review/critique.

Lucy

MrMoke
11-13-2016, 09:04 PM
Hi Lucy- Gosh. There are numerous problems. This is a tough game because in a 3D environment it's often hard to see how to move the cone to the actual drop point. Camera placement is probably critical.

1) The cone isn't really on the ground, so you have no real way to judge the distance. It's actually floating in the air.
2) Next note the center point of the cone is in the middle not the base while the center of the torus in the center of the circle. The distance is measured between those two points.
3) Those two problems mean, you have no way of telling whether the drop distance is even close to the .1 you are checking for.

Now for the code--
1) When you click on the instructions you make them disappear, but never call the main method, so nothing happens.

If you did add the call then:

2) The main method starts with an infinite loop that starts with the torus falling from the sky. (Problem: That turns out to be a loop that moves the torus down 10 times before it stops, so the torus has moved down 27 meters before the check is done.)
3) The first loop is infinite, so the second infinite loop is never reached. The first one just keeps pushing the torus down 27 meters at a time.
4) Lastly, nothing in the program actually moves the torus back up to a random starting position.

Lot of work to do...;)

lucyrn99
11-15-2016, 12:53 AM
Hi Mr. Moke,

I apologize.. I should have clarified that I wanted assistance just with the score-keeping part of the game, not with any of the other parts.

I had attached my (very messy and not audience-ready) code with the intent that you'd get a general sense of the scoring that needed to be tallied.

Thank you for your feedback. I'm still not seeing the score increment as I would expect it to, when the torus is close to the cone.
I understand your comment about the center of the cone being its middle, therefore I've allowed some extra cushion (.5 meters' worth) to compensate for that. However, it still doesn't work properly to add 1 to the score when the torus and cone are within close proximity.

Please see attached (cleaned-up version). Thank you for your interest and help!

chickentree
11-15-2016, 01:20 AM
Hi Mr. Moke,

I apologize.. I should have clarified that I wanted assistance just with the score-keeping part of the game, not with any of the other parts.

I had attached my (very messy and not audience-ready) code with the intent that you'd get a general sense of the scoring that needed to be tallied.

Thank you for your feedback. I'm still not seeing the score increment as I would expect it to, when the torus is close to the cone.
I understand your comment about the center of the cone being its middle, therefore I've allowed some extra cushion (.5 meters' worth) to compensate for that. However, it still doesn't work properly to add 1 to the score when the torus and cone are within close proximity.

Please see attached (cleaned-up version). Thank you for your interest and help!
Suggestion:
Try using "print" (along bottom with loop, do in order etc) to print out the distance between the torus and the cone.

MrMoke
11-15-2016, 08:38 AM
Mark is correct in recommending the use of print statements for troubleshooting. Try this slightly modified version that demonstrates some of the logic problems that you still have in place.