View Single Post
Old
chickentree
Super Moderator
 
Status: Offline
Posts: 250
Join Date: Dec 2012
Location: Frosno, Ca
Default 01-14-2014, 08:40 AM

Since this is entirely event driven, you don't need to use "When the world starts" unless there is some non-event things to be done. I do see a couple of potential problems though.
  1. If the gorilla is less that 2 meters from the target, then the value of min passed to the random function will be greater than the value of max. I do not know how this would be handeled by Alice.
  2. You are moving at least 2 meters but checking if the gorilla is within 1 meter of the target. In algebra this would work, but it does not always work in Alice due to round offs. If the gorilla is a little over 1 meter from the target then moving 2 meters could put it just over 1 meter from the target in which case, the gorilla would continue to move forward for ever.
  3. Possibly the biggest problem with you code is really simple, the "go to Animal" method does not do anything once the gorilla is within 1 meter of the target except stop. This is where you want to turn the target invisible! The other While events are not needed, just set the target's opacity to 0 in the if part of the condition.


Mark Henwood
mhenwood@ieee.org
   
Reply With Quote