Quote:
Originally Posted by BadWolfGeronimo
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:
- Move the ring some random amount in some random direction.
- Make the ring invisible.
- Move it back where it was to start with.
- Repeat these steps with another ring.
- See if the first ring is close to the cone If it is increment wins, else increment loss.
- 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