Alice Community Not looking for a solution, just a push in the right direction..
 User Name Remember Me? Password

 Thread Tools Display Modes
 Not looking for a solution, just a push in the right direction..
gballa1993
Junior Member

Status: Offline
Posts: 5
Join Date: Dec 2013
Location: Louisiana
Not looking for a solution, just a push in the right direction.. - 01-03-2014, 02:39 PM

My assignment is to make a game in which I click on three different objects, when I click on each object, a gorilla moves towards it, moving at a random rate anywhere from 2 meters to 1/2 the gorilla's distance to the object. Once the gorilla gets within 2 meters of the object, the object fades to transparent. Where am I going wrong? I've been working on this for weeks.
Attached Files
 GorillaGam!.a2w (2.09 MB, 24 views)

 mmar Junior Member   Status: Offline Posts: 11 Join Date: Sep 2011 01-04-2014, 10:25 AM Looks like you forgot on start app, because app doesn't run in A2.4, and I can't reproduce the problem because of my lack of time. But I suppose you did not analize approaching objects to each other. The system does not deteck the moment the object is within 2 meters of the obstacle. You need to know that the loop you maybe have, should control the distance. Use step by step controling structure, measure the distance, and I'm sure you are going to find the solution.
 chickentree Super Moderator   Status: Offline Posts: 250 Join Date: Dec 2012 Location: Frosno, Ca 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. 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. 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. 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

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops General Discussion     Questions and Comments     The Lounge