View Full Version : If/Else
reddStarr
05-04-2009, 05:46 PM
:) Hi I'm new, and new to storytelling alice but i'm very good at using it....
:confused::mad: Umm but I was wandering if anyone could tell me how the if/else part of storytelling alice works. I'm having trouble because I'm trying to make a game but I don't know what to use to make something like:
When this happens
This will happen next
Thank you - reddStarr
HisWorld
05-04-2009, 08:06 PM
Bascially I think you have the idea of an if-else statement.
It is a conditional statement, just a logical switch.
If "a certain condition is true"
then "a certain event will happen i.e. a variable will change, a method is called"
Else" a different condition will occur, this could be the start of another
if-then else statement"
Ok I tried to include some alice code with color's but because of the forum's file size restriction I could only attach it in a .txt document.
reddStarr
05-04-2009, 08:09 PM
What do you mean by test... do you mean trial and error
HisWorld
05-04-2009, 09:24 PM
I updated my post
veghead05
05-04-2009, 09:30 PM
The first thing that comes to mind is the If/else, as you said.
You drag the If/else tile (from the bottom) into the method editor. Under the If part is your "when this happens" part, also known as the condition. Think of it as a trigger for something to happen.
The else part can be left blank, if you are only concerned with one thing happening; otherwise, you can put an alternative method--something that happens when your condtion is not met.
As an example, say you want an arrow to explode into confetti if it hits a bullseye. The condition would be, If it hits the bullseye... the instructions for the if would be that it explodes into confetti.
You could leave it at that, leaving the else part blank, or you could add an else statement--such as, if it doesnt hit the bullseye, then the arrow turns gray.