Alice Community  

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

Reply
 
Thread Tools Display Modes
Else If Else statement
Old
jameto333
Guest
 
Status:
Posts: n/a
Default Else If Else statement - 01-31-2010, 11:15 PM

How can I make an Else If Else Statement work in Alice. I am stumped and trying to get some assistance for my schoolwork. I appreciate any help
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 02-01-2010, 11:46 AM

If else if statements are like a fork in the road when the Alice world is running. If the condition (the thing at the top that initially says true, but can be changed to any boolean value or expression) is true, the top event is done. If not, the bottom is done.

Try this: Create a grass world with a bunny. Now, open the scripting area (the big yellow area that you can drag tiles onto) and drag an if/else if statement onto it. Now, drag a bunny move method into the top (do nothing) area of the if/else if statement.

If you play your world, the bunny will move up because true is selected on the if/else if statement.

Now, go back and change the true value to false and replay your world. The bunny should not move at all, because the top event, the one that only happens if the condition is true, was skipped and the bottom one, the one that says to do nothing, was done instead.

Experiment with trying to drop different things onto the condition of the if/else if statement to see just what kinds of choices you can have the world make based on the conditions of the world. There are TONS of possibilities, so go nuts!


(')>
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 02-01-2010, 12:35 PM

WEll, if you would like me to make a tutorial on it i would. I did post avariable lesson that involes "If/else" Its hard to explain


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
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 ©2022, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.