I am not sure I understand what confuses you.
Let me tell you a few things about
switch, which you may already know.
switch is from C language and it looks like this:
- Code: Select all
switch (some_integer_variable) {
case a: some_code; break;
case b: some_code; break;
case c: some_code; break;
...
default: some_code; break;
}
This code has nothing to do with Game Editor, this is how C switch looks, wherever you use it and whenever you use it.
a, b, c, ... are integer values.
case a: some_code; break; means - in case that some_integer_variable has value a, do some_code.
You don't need to put break at the end of case, but then the next case will execute and so on until the first break.
default is not necessary. It will execute if value of some_integer_variable doesn't match any case.
So, switch is used for multiple choices. Which choice will be executed depends on some_integer_variable.
As I can see, you change state variable only inside switch. In the beginning it is 0 because you didn't initialize it. So case 0 will execute. One of the consequences is that state is now 1, because of code line state = 1;. switch has nothing to do with animations and their position on players animation list.