by lcl » Mon Apr 14, 2014 11:04 pm
Oh, sorry, I forgot to answer you..
The reason why it doesn't allow the walking animations to play is that you still didn't check if the jump key is not pressed, in other words, if
KEY_x == 0. You checked if it was pressed and that caused him to not change his animation back to walking.
However, making it check if the key is not pressed doesn't still solve all problems.
The easiest fix is to just leave the whole check away.
Sure, this makes the actor jump immediately when touching ground if you're still holding the jump button, and that is another problem. That problem can be solved by setting the repeat of the x key down event to disabled, but then another problem appears, in the form of the character doing funny movement when you land from a jump and keep holding x down. And that can be solved by doing this:
- Remove the key[KEY_x]!=1 conditions from the 5th and 7th if's in the draw actor code
- Replace the key[KEY_x] == 1 from the 9th and 12th if's in the draw actor code with jump==0
The reason why this is so complicated is because of how you manage your movement. Having it all based on what keys are pressed and what aren't makes it very difficult to follow what is happening in the code when playing. I'd suggest you to learn the state method (search "state method" on the game editor wiki).