Animate sequence is not working well...
privateint[] sequenceWalkRight ={ 2, 3, 0, 2, 3, 0, 2, 3, 0};
privateint[] sequenceWalkLeft ={ 4, 5, 0, 4, 5, 0, 4, 5, 0, 4, 5, 0};
publicvoid moveSprite(char direction){
switch (direction){
case'u':{
this.move(0, -(MOVE_SIZE));
break;
}
case'd':{
this.move(0, MOVE_SIZE);
break;
}
case'r':{
this.setFrameSequence(this.sequenceWalkRight);
this.move(MOVE_SIZE, 0);
break;
}
case'l':{
this.setFrameSequence(this.sequenceWalkLeft);
this.move(-(MOVE_SIZE), 0);
break;
}
}
this.nextFrame();
}
This method is called when the user presses the cell keys. Then this method receives a char that represents direction the sprite should move. If user presses right key, the setFrameSequence is set for right. If the user presses left key, the setFrameSequence is set for left.
But the problem is that the animation goes through right or left sequences only when the user presses UP or DOWN.
What's going on here?
Thanks for your reply.

