Oh right, I think the jittering is caused by the fact that when you set angles to a negative value, c2 converts it to a 0-360 range.
so, as soon as you rotate counter clockwise past 0 degree it will go to 360 then it's clamped to 15...
So basically you have a sequence of values like that (if isMirrored is true and you have a steady 60fps which gives you a 1/60=0.017 for the value of dt) :
frame 1: 0
frame 2: clamp(0-120*0.017,-15,15) = -2.04
-> converted to 357.96
frame 3: clamp(357.96 - 2.04,-15,15) = 15
... ... ...
and it will go back to 0 as long as you're jumping
So yeah using your RotateTo variable is a good idea (:
And for the dt... Basically to understand how things work, look at how the values evolve when using it.
dt is the time between the previous and the current frame.
in a 60fps game,
<font face="Courier New, Courier, mono">dt = 1/fps = 1/60 = 0.01666666666</font>
(dt is the "second per frame" so spf = 1/fps :D )
let's simplify to 0.017
If you add dt to a value every frame:
<font face="Courier New, Courier, mono">0.017+0.017+0.017+..... </font>
After exactly one second, which is 60 frames, the value will be equal to
<font face="Courier New, Courier, mono">60*1/60 = 1</font>
in a 30 fps game, after one second, which is 30 frames, you'll get
<font face="Courier New, Courier, mono">30*1/30 = 1</font>
So basically, in whatever fps you are, the succession of addition will all reach 1 after one second.
if you add 5*dt, the value will reach 5 after one second
so basically, if you
<font face="Courier New, Courier, mono">set X to self.X + 5*dt </font>
you add 5px to X every one second, so you move your object at exactly 5px per second
It works the same with angle:
<font face="Courier New, Courier, mono">set angle to self.angle + 5*dt </font>
will rotate at 5 degree per second.
that's the holy magic of dt in a nutshell =)