Learn Create Your Own Split Screen

Next Page

There's a pretty straightforward solution, which is that we change the rotation, do our drawing, then "unrotate". It's not the best solution, but it will definitely work:

ctx.rotate(this.angle * Math.PI / 180); if (this.visible) ctx.drawImage(this.MyImg, this.x, this.y); ctx.rotate( -this.angle * Math.PI / 180);

We rotate, we draw, then we unrotate (note the use of the minus sign before "this.angle" in the second call to rotate).

Try the left or right keys now.

Slightly better?