mirror of
https://github.com/danbulant/arcade-machine
synced 2026-07-03 01:50:43 +00:00
Audio FX
This commit is contained in:
parent
1eaa99e16f
commit
9b38b4fd95
5 changed files with 14 additions and 4 deletions
BIN
ui/Audio/audiostart.mp3
Normal file
BIN
ui/Audio/audiostart.mp3
Normal file
Binary file not shown.
BIN
ui/Audio/audiostart2.mp3
Normal file
BIN
ui/Audio/audiostart2.mp3
Normal file
Binary file not shown.
BIN
ui/Audio/audiostart3.mp3
Normal file
BIN
ui/Audio/audiostart3.mp3
Normal file
Binary file not shown.
BIN
ui/Audio/switchfocus.mp3
Normal file
BIN
ui/Audio/switchfocus.mp3
Normal file
Binary file not shown.
|
|
@ -41,7 +41,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<audio id="Switchfocus">
|
||||||
|
<source src="Audio/switchfocus.mp3" type="audio/mpeg">
|
||||||
|
</audio>
|
||||||
|
<audio id="Audiostart">
|
||||||
|
<source src="Audio/audiostart.mp3" type="audio/mpeg">
|
||||||
|
</audio>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const prvnihra = [...document.querySelectorAll("button")]
|
const prvnihra = [...document.querySelectorAll("button")]
|
||||||
|
|
@ -56,35 +61,40 @@
|
||||||
document.addEventListener("keydown",function(sex2){
|
document.addEventListener("keydown",function(sex2){
|
||||||
if (sex2.code === "KeyD"){
|
if (sex2.code === "KeyD"){
|
||||||
if(i>=prvnihra.length - 1) i = -1;
|
if(i>=prvnihra.length - 1) i = -1;
|
||||||
|
document.getElementById("Switchfocus").play();
|
||||||
i++;
|
i++;
|
||||||
prvnihra[i].focus();
|
prvnihra[i].focus();
|
||||||
console.log("right", i);
|
console.log("right", i);
|
||||||
console.log("array je", prvnihra.length);
|
console.log("array je", prvnihra.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
document.addEventListener("keydown",function(sex3){
|
document.addEventListener("keydown",function(sex3){
|
||||||
if(sex3.code === "KeyA"){
|
if(sex3.code === "KeyA"){
|
||||||
|
document.getElementById("Switchfocus").play();
|
||||||
if(i<=0) i=prvnihra.length
|
if(i<=0) i=prvnihra.length
|
||||||
i--;
|
i--;
|
||||||
prvnihra[i].focus()
|
prvnihra[i].focus()
|
||||||
console.log("left", i);
|
console.log("left", i);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (sex3.code === "KeyE"){
|
if (sex3.code === "KeyE"){
|
||||||
|
document.getElementById("Audiostart").play();
|
||||||
console.log(document.activeElement);
|
console.log(document.activeElement);
|
||||||
document.activeElement.click();
|
document.activeElement.click();
|
||||||
}
|
}
|
||||||
if(sex3.code === "KeyS" && i+3 < prvnihra.length){
|
if(sex3.code === "KeyS" && i+3 < prvnihra.length){
|
||||||
|
document.getElementById("Switchfocus").play();
|
||||||
console.log(i);
|
console.log(i);
|
||||||
i = i+3;
|
i = i+3;
|
||||||
prvnihra[i].focus();
|
prvnihra[i].focus();
|
||||||
}
|
}
|
||||||
if(sex3.code === "KeyW" && i-3 >= 0){
|
if(sex3.code === "KeyW" && i-3 >= 0){
|
||||||
|
document.getElementById("Switchfocus").play();
|
||||||
console.log(i);
|
console.log(i);
|
||||||
i = i-3;
|
i = i-3;
|
||||||
prvnihra[i].focus();
|
prvnihra[i].focus();
|
||||||
}
|
}
|
||||||
document.body.requestFullscreen();
|
//document.body.requestFullscreen();
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue