This is the walking algorithim for walking in my pokemon game. At first the character walks really fast, but soon he starts to slow down, then he gets slower and slower and slower. I tried to make sure I have no memory leaks, but somewhere it's acting up. Can you help me? (and possibly optimise at the same time.)
:real(0,1 //clears graph :0→A:16→B:0→C:0→D:1→E :Lbl 1 :real(2,1,F,G,12,8,0,12,0,8,12,0,8,1 //Tilemap. Variables 'F' and 'G' controll the scrolling of the matrix. (there starting values are set in a different subprogram) :real(1,40,22,2,16,14,A,B,0,0,1 //Character sprite :Repeat K=24 or K=34 or K=26 or K=25 :getkey→K :End :If K=26:Then :4→A:0→B:6→C:0→D:F+1→F :Goto 2 :End :If K=24:Then :0→A:0→B:2→C:0→D:F-1→F :Goto 2 :End :If K=25:Then :0→A:32→B:32→D:G-1→G :If E=1:Then :2→C:2→E :Goto 2 //The reason the direction arrows up and down have the E part, is so the Character steps with his left foot first or his right foot first. :End :If E=2:Then :4→C:1→E :Goto 2 :End :End :If K=34:Then :0→A:16→B:16→D:G+1→G :If E=1:Then :2→C:2→E :Goto 2 :End :If E=2:Then :4→C:1→E :Goto 2 :End :End :End :Lbl 2 :For(X,1,3 \\ :real(1,40,22,2,16,14,C,D,0,0,1 \\ These 3 lines are for the walking animation. :For(Y,1,3 \\ :End :End :Goto 1
I really hope you guys can spot the bug and tell me how to fix it, so I don't end up doing it again. Thanks in advanced.