Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Individual item collision from a list? (http://www.alice.org/community/showthread.php?t=7938)

SpecOpsSammich 01-16-2012 05:12 PM

Individual item collision from a list?
 
1 Attachment(s)
I'm making a lawn mowing game that has the player run over 30 ferns to clear a field in 3 minutes, and im having trouble getting the lawnmower interact with the ferns from a list. I have:
For all ferns in list, every ferns in list
If lawnmower distance to items from fernList < 2
then increment world scoreSet by 1
and fern turns invisible
Else nothing
I believe the error is the If part, trying to get the lawnmower to interact with all items from the list, then trying to get the individual item in the list to disappear. Is there an easier way to accomplish this? please help.

If it helps i attatched the world

Mr Kidnapper 01-16-2012 06:58 PM

1 Attachment(s)
Fix'd.
The problem with your world was that you already had two whiles in the same method.
One while can't be started until the things before it are finished, so in your configuration, if you wanted to start cutting ferns then the timer had to run out first. Also: A better function to use in terms of finding bounds is "Object is within threshold"

SpecOpsSammich 01-16-2012 07:09 PM

Aha! I was trying to cram in an example of everything i learned yesterday, thanks! And for some reason people in my class and I can never get within threshold to work

sfunk 01-17-2012 10:29 AM

[QUOTE=SpecOpsSammich;45722]Aha! I was trying to cram in an example of everything i learned yesterday, thanks! And for some reason people in my class and I can never get within threshold to work[/QUOTE]

It's probably because the "within" function uses the distance from the center(usually the main axis) of the object. Which this means you have to know the depth of the object on top of the actual distance you want from the object itself.


All times are GMT -5. The time now is 07:48 AM.

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