Alice Community "While" function ?

 "While" function ?
 Laur07 Junior Member   Status: Offline Posts: 11 Join Date: Jun 2011 "While" function ? - 06-20-2011, 03:38 PM One of my methods in my project consists of a condition :Create a method called "fishJump". This method should take one fish object as a parameter and make that fish jump up out of the water and back in, at random speeds, and move a little away from the camera after each jump. It should continue to do this until either the fish is at least 10m away from the camera, or all 5 fish have been caught (use numCaught variable). I used a "While" condition for this and made the fish jump infinity times but then i guess because of the "infinity" the rest of my project doesnt work after this ? Because i have another step after but it doesnt even acknowledge it....Am i doing this right ?
 beachbum111111 Senior Member     Status: Offline Posts: 852 Join Date: Feb 2010 Location: e 06-20-2011, 03:55 PM Can you post your world? "Don't lead me into temptation I can find it myself"
Laur07
Junior Member

Status: Offline
Posts: 11
Join Date: Jun 2011
06-20-2011, 04:00 PM

So its the "JumpFish" method that i guess is the problem ... and as i said i am not sure if i need to keep the infinity loop because nothing in my world method happens after but at the same time i need to keep my fish moving ...

thank you!!
Attached Files
 tutorial 11.a2w (456.7 KB, 23 views)

 Mr Kidnapper Senior Member   Status: Offline Posts: 442 Join Date: Feb 2011 06-21-2011, 05:40 PM What you have to do is make the Fish Jump method independent of the other methods. I assume you noticed the fish are still caught when the jump is in a loop, but the first method does not continue. Activate the FishJump method in another method, perhaps with a delay so that it at least looks like it happens at the same time. You could also use a variable. Say after the fishing boat says something "Set Jumping Fish to True" and an event "If Jumping Fish == True" "During - For each item from FishList together: JumpFish whichFish== item from FishList" There is no FishList, but if you have not learned Lists and Arrays yet, it is a set of variables (Objects, strings, numbers, whatever.) so you don't have to make five 'When mouse is clicked on' events.

 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