(event)
| 62 | document.addEventListener("keydown",direction); |
| 63 | |
| 64 | function direction(event){ |
| 65 | if(event.keyCode==37&&d!="RIGHT"){ |
| 66 | left.play(); |
| 67 | d="LEFT"; |
| 68 | }else if(event.keyCode==38&&d!="DOWN"){ |
| 69 | up.play(); |
| 70 | d="UP"; |
| 71 | }else if(event.keyCode==39&&d!="LEFT"){ |
| 72 | right.play(); |
| 73 | d="RIGHT"; |
| 74 | }else if(event.keyCode==40&&d!="UP"){ |
| 75 | down.play(); |
| 76 | d="DOWN"; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | //check collision function |
| 81 | function collision(head,array){ |
nothing calls this directly
no outgoing calls
no test coverage detected