Animation channels

I’m working with animations and got confused how exactly should I work with channels.
Here’s my code:
[java]AnimChannel channel = animCtrl.getChannel(0);
if (up || down || right || left) {
if (channel.getAnimationName() == null) {
channel.setAnim(“walk”, 1f);
channel.setLoopMode(LoopMode.Loop);
}

        } else if (isSpeed && up || down || right || left) {
            if (channel.getAnimationName() == null) {
                channel.setAnim("run", 1f);
                channel.setLoopMode(LoopMode.Loop);
            }

        } else {
            channel.reset(true);
        }[/java]

Walking works fine but when I hold SHIFT for speed I wanna get running animation, not walk, so I have to create other channel for running?

Your if statement has a problem…

You wont ever reach the second statement. Try:

[java]
if (!isSpeed && (up || down || right || left)) {
} else if (isSpeed && (up || down || right || left)) {
} else {
}
[/java]

Also, don’t forget to encapsulate the up || etc…

As it is right now your saying:

if isSpeed and up or (just) left or (just) right or etc etc