Alice Community Count something, then say something IF...

 Count something, then say something IF...
cartwheels
Guest

Status:
Posts: n/a
Count something, then say something IF... - 05-10-2011, 10:16 PM

Hi there,

I'm working on a small assignment and what I want to do is count the number of times that a wolf chases a rabbit, then have it say something like "That was easy" if the wolf took 10 steps or less, and say "That was tough but worth it" if it took more than 10 steps.

I'm also having trouble keeping the wolf above ground when it tries to eat the rabbit. Not sure how to fix that.

If anyone would like to help, with simple instructions it would be greatly appreciated. Thanks in advance!

P.S. I'm using Alice 2.2
Attached Files
 Rabbit Wolf.a2w (572.5 KB, 7 views)

 TauTrumpsPi Senior Member     Status: Offline Posts: 399 Join Date: Mar 2011 Location: The diamond layer 05-11-2011, 06:01 AM Make sure your wolf is oriented to the ground, and then turn it around to the rabbit. For the dialogue thing, include a variable that increments by 1 every time the wolf takes a step inside the wolf walking method. Then inside your catch method, put an if/else saying if said variable is more than 10, wolf say this dialogue. Else, say the other dialogue. -------------------------------------------------------------------------------------------------------------------------- I have plenty of common sense. I just choose to ignore it. -Calvin and Hobbes Wondering about my Avatar? http://en.wikipedia.org/wiki/Tardigrade Wondering about my username? http://www.youtube.com/watch?v=jG7vhMMXagQ
 reuben2011 Senior Member     Status: Offline Posts: 489 Join Date: Sep 2009 Location: Hawaii 05-11-2011, 05:21 PM Yep. The part where the wolf says something should look like the following considering that you have variable called steps that counts the number of steps. Code: if(steps <= 10) {wolf.say("That was easy");} else {wolf.say("That was tough but worth it.");} Projects -Escape the Kitchen -That ninja animation -Hill Collision Upcoming Projects -Some penguin adventure game?
 cartwheels Guest   Status: Posts: n/a 05-12-2011, 01:45 AM Thank you for your assistance!
 reuben2011 Senior Member     Status: Offline Posts: 489 Join Date: Sep 2009 Location: Hawaii 05-12-2011, 06:15 PM No prob. Feel free to come back if you have any more problems later on! Projects -Escape the Kitchen -That ninja animation -Hill Collision Upcoming Projects -Some penguin adventure game?
 Laur07 Junior Member   Status: Offline Posts: 11 Join Date: Jun 2011 06-13-2011, 01:35 AM Hey i am having the exact same troubles, i am kinda confused about the variable "steps" part. I created one but it doesn't seem to be doing the job, could you explain this part by any chance?

 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