Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Not looking for a solution, just a push in the right direction.. (http://www.alice.org/community/showthread.php?t=10444)

gballa1993 01-03-2014 02:39 PM

Not looking for a solution, just a push in the right direction..
 
1 Attachment(s)
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.

mmar 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 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.
[LIST=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.[*]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.[/LIST]


All times are GMT -5. The time now is 07:19 PM.

Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.