Drawing in JavaScript / HTML5 using XOR to remove old sprite
问题 I'm building the engine for a tiny game, and right now I have just got a red circle with two little eyes as a main character. I have keyPress functions to detect movement, and that works, but I wanted to use something I used a long time ago in QBASIC to remove the character and redraw at a new location: XOR Basically, on keypress this happens: if (code == 39) { mainChar.drawChar(); mainChar.x += 1; mainChar.leftEye.x += 1; mainChar.rightEye.x += 1; mainChar.drawChar(); } I thought drawing the