Original Post
Hi, I am new here so sorry if this is a re-post ( I had a go with the search but couldn't find anything) I am currently making a simple top down RPG game with scrolling tile background and such ... I would like to use Sprite.setFrameSequence / Sprite.nextFrame() to have my main character animate as he walks. At the moment my key handling is done using a switch statement which runs on each loop as follows ... private void checkUserInput() { // get the state of keys int keyState = getKeyStates(); // calculate the direction pollKeys(keyState); } private void pollKeys(int keyState) { switch(keyState) { case RIGHT_PRESSED: directionChanged(); player.setFrameSequence(rightSequence); player.moveright = true; player.movingFlag = true; break; ... } } However, this is causing the animation to jump straight back to index 0 on every loop. What is the normal way of implementing the setFrameSequence function ? I'm guessing the switch statement isn't the best way of polling the keys and is part of the problem but I'm stumped as to how to prevent the sequence being reset on each loop :( Any help / advise would be greatly appreciated ! Thanks in advance Pookster