MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / getKeyAndMove

Function getKeyAndMove

assets/js/amongus.js:24–57  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

22
23// On Pressing the key [The Main function]
24function getKeyAndMove(e){
25 getAudio();
26
27 if(leftl.style.transform ="rotate(0deg)"){
28
29 leftl.style.transform ="rotate(20deg)";
30 setTimeout(function(){ leftl.style.transform ="rotate(0deg)"; }, 450);
31
32 }
33
34 if(rightl.style.transform ="rotate(0deg)"){
35 rightl.style.transform ="rotate(-20deg)";
36 setTimeout(function(){ rightl.style.transform ="rotate(0deg)"; }, 450);
37 }
38
39// Fetching the key code value
40 var key_code=e.which||e.keyCode;
41 switch(key_code){
42 case 37: //left arrow key
43 moveLeft();
44
45 break;
46 case 38: //Up arrow key
47 moveUp();
48 break;
49 case 39: //right arrow key
50 moveRight();
51 break;
52 case 40: //down arrow key
53 moveDown();
54 break;
55 }
56
57 }
58
59// Dark and Light Mode function call
60

Callers

nothing calls this directly

Calls 5

getAudioFunction · 0.70
moveLeftFunction · 0.70
moveUpFunction · 0.70
moveRightFunction · 0.70
moveDownFunction · 0.70

Tested by

no test coverage detected