->CK - I said Java and Javascript are different. For me JS and Javascript mean the same thing - the files have a .js extension. Java source code usually ends with .java.
Between Java, JavaScript, JScript, JQuery and sleep deprivation I'm a bit confused. I'm ready for a holiday again, and I've only been back to work for a week

All I know about Java is that I don't want to install the SDK again - it was a pain in the bottom.
Anyway, I prefer 25fps for no good reason - most machines these days should be able to do 30fps or 40fps with few or no problems. Seems a bit odd that I have nostalgia for a frame rate. Time I upgraded!
I noticed during the recent Christmas competition that my entry was running slower on my laptop than it was on my work desktop when I was using setTimeout() at the end of each frame, but setInterval() made things more consistent, so only a very slow machine should start to skip frames.
As for mouse position and key inputs, I have built a couple of functions to deal with them.
Add the following to the body tag:
<body onKeydown="control(1, event);" onKeyup="control(0, event);">Then add the following to the canvas tag:
<canvas id="canvas_id" width="canvas_width" height="canvas_height" onMouseMove="mouseCon(event);" style="cursor:none;"> where canvas_id, canvas_width and canvas_height are your preferred settings. The style attribute hides the mouse pointer should you want to add a custom pointer in the demo, such as a cross-hair

Next in your JavaScript code, create these variables:
var keyboard = new Array();
var mouseX = 400, mouseY = 300;
// Firefox Check
var ffx = false;
var cnvsX = 0, cnvsY = 0;Then add this code which should run only once before the main program function:
// If the browser is Firefox, locate the canvas position in the document
if(navigator.userAgent.indexOf("Firefox") > -1){
ffx = true;
cnvsX = c.offsetLeft;
cnvsY = c.offsetTop;
}
// Reset the keyboard
for(i = 0; i < 256; i++){
keyboard[i] = 0;
}Also add these functions:
// Keyboard Controls
var control = function(et, evt){
if(ffx){
event = evt;
}
keyboard[event.keyCode] = et;
}
// Mouse Movement Control
var mouseCon = function(evt){
if(ffx){
event = evt;
mouseX = event.clientX + document.body.scrollLeft + document.documentElement.scrollLeft - cnvsX;
mouseY = event.clientY + document.body.scrollTop + document.documentElement.scrollTop - cnvsY;
}else{
mouseX = event.offsetX;
mouseY = event.offsetY;
}
}With each key press (or release), the keyboard array entries will be set to either 0 or 1. The following page contains a list of common key codes - these codes match with the addresses in the keyboard array:
http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codesPlease let me know if I have missed something or designed something which is horribly inefficient.