View Full Version : help!!
magic
09-11-2005, 05:48 AM
i am programming a game called snake i used a loop but
he calculated how my snake should walk and then he showed "game over" but he didn't let see how the snake went. Help me please!!! And another thing what are the commands for the down key and the left key and the right key and the up key??????
greetz magic :think:
magic
09-12-2005, 10:24 AM
does nobody know the answer?
magic
09-12-2005, 10:32 AM
:shifty: :shifty: if so forget the snake and tell me what the events are for the up key,down key,left key and right key!!! :(
Archangel
09-12-2005, 03:46 PM
function checkArrows (field, evt) {
var keyCode =
document.layers ? evt.which :
document.all ? event.keyCode :
document.getElementById ? evt.keyCode : 0;
var r = '';
if (keyCode == 39)
r += 'arrow right';
else if (keyCode == 40)
r += 'arrow down';
else if (keyCode == 38)
r += 'arrow up';
else if (keyCode == 37)
r += 'arrow left';
r += ' ' + keyCode;
window.status = r;
return true;
}
magic
09-13-2005, 07:38 AM
thanks but if i want for exampble: if you put down the up arrow key a alert appears. should i write in the script: if keyCode == 38 alert ('hahaha');
?????
Archangel
09-13-2005, 07:40 AM
Well...try it out and see what happens.
magic
09-13-2005, 07:42 AM
do you know the answer of my qeustion about the snake???
magic
09-13-2005, 07:54 AM
well... it didn't work so what should you do???
CruxShadow
02-09-2006, 10:55 PM
first of all that '==' you put into the keycode part of the script means if the data equals whatever is on the other side of the '=' and that the data is the same type.
vBulletin v3.0.3, Copyright ©2000-2012, Jelsoft Enterprises Ltd.