View Single Post
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 01-05-2017, 07:33 PM

Quote:
Originally Posted by BadWolfGeronimo View Post
Okay, my instructor helped me figure out the array thing. I was trying to do that in the first place but for some reason I got thrown by it. But I still can't get my ring count to work. I've moved my if statement to every possible place and it's doing nothing. It worked fine with my single ring game I don't understand why I can't do it now. Here's my updated game.
Although I know it is tempting to try and just move stuff around until it works, it is hardly ever productive and when it does work you rarely understand why.
Unfortunately the alternative is usually painful, yet it can be strangely rewarding in the end. You need to read the code and understand what it is doing. In the present case you are doing something like this:
  1. Move the ring some random amount in some random direction.
  2. Make the ring invisible.
  3. Move it back where it was to start with.
  4. Repeat these steps with another ring.
  5. See if the first ring is close to the cone If it is increment wins, else increment loss.
  6. See if the second ring is close to the cone. If it is increment wins, else increment loss.

As you can probably see unless the rings started out close enough to the cone they will probably not be close enough when they are moved back.
There is another problem with the code that is a quirk in Alice. That is that when an object is totally transparent (its opacity is 0.0), it does not work properly when used in distance and comparison measurements. This does not happen often but I have seen it.

Mark


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote