You misunderstood. Here is the code for your animation:Quote:
Originally Posted by jman420
Without changing the animation control code (above), how would an extra attack animation that is 3 times long fit in? More if statements? Bad design move.Quote:
if timerL >= 10 then characterL = playerL2 end
-- change when numbers are hit --
if timerL >= 20 then characterL = playerL3 end
if timerL >= 30 then characterL = playerL4 end
if timerL >= 40 then characterL = playerL5 end
-- change when less then 10 --
if timerL <= 10 then characterL = playerL end
-- other animation directions --
if timerR == 50 then timerR = 0 end
if timerR <= 10 then characterR = playerR end
if timerR >= 10 then characterR = playerR2 end
if timerR >= 20 then characterL = playerR3 end
if timerR >= 30 then characterL = playerR4 end
if timerR >= 40 then characterL = playerR5 end
if timerD == 20 then timerD = 0 end
if timerD <= 10 then characterD = playerD end
if timerD >= 10 then characterD = playerD2 end
if timerD >= 20 then characterL = playerD3 end
if timerD >= 30 then characterL = playerD4 end
if timerD >= 40 then characterL = playerD5 end
if timerU == 20 then timerU = 0 end
if timerU <= 10 then characterU = playerU
if timerU >= 10 then characterU = playerU2 end
if timerU >= 20 then characterL = playerU3 end
if timerU >= 30 then characterL = playerU4 end
if timerU >= 40 then characterL = playerU5 end
Currently you have 24 if statements running each loop, that is 24 branches of code and it WILL slow down the framerate (at least it does on complied languages). Now considering that this section of code is just for the player graphic, what happens when we have 20 NPCs on the screen at the same time? Taking the current coding method it would be 20 x 24 more if statements ran each frame. Not good for framerate.
The usability is fine, the performence is what worries me.