Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Count something, then say something IF...
Old
cartwheels
Guest
 
Status:
Posts: n/a
Default 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
File Type: a2w Rabbit Wolf.a2w (572.5 KB, 7 views)
   
Reply With Quote
Old
TauTrumpsPi
Senior Member
 
TauTrumpsPi's Avatar
 
Status: Offline
Posts: 399
Join Date: Mar 2011
Location: The diamond layer
Default 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
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 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?
   
Reply With Quote
Old
cartwheels
Guest
 
Status:
Posts: n/a
Default 05-12-2011, 01:45 AM

Thank you for your assistance!
   
Reply With Quote
Old
reuben2011
Senior Member
 
reuben2011's Avatar
 
Status: Offline
Posts: 489
Join Date: Sep 2009
Location: Hawaii
Default 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?
   
Reply With Quote
Old
Laur07
Junior Member
 
Status: Offline
Posts: 11
Join Date: Jun 2011
Default 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?
   
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump



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