mirror of
https://github.com/danbulant/arcade-machine
synced 2026-06-16 13:01:07 +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>
|
||||
|
||||
|
||||
<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>
|
||||
const prvnihra = [...document.querySelectorAll("button")]
|
||||
|
|
@ -55,36 +60,41 @@
|
|||
var i = 0;
|
||||
document.addEventListener("keydown",function(sex2){
|
||||
if (sex2.code === "KeyD"){
|
||||
if(i>=prvnihra.length - 1) i = -1;
|
||||
if(i>=prvnihra.length - 1) i = -1;
|
||||
document.getElementById("Switchfocus").play();
|
||||
i++;
|
||||
prvnihra[i].focus();
|
||||
console.log("right", i);
|
||||
console.log("array je", prvnihra.length);
|
||||
}
|
||||
|
||||
})
|
||||
document.addEventListener("keydown",function(sex3){
|
||||
if(sex3.code === "KeyA"){
|
||||
document.getElementById("Switchfocus").play();
|
||||
if(i<=0) i=prvnihra.length
|
||||
i--;
|
||||
prvnihra[i].focus()
|
||||
console.log("left", i);
|
||||
|
||||
}
|
||||
if (sex3.code === "KeyE"){
|
||||
document.getElementById("Audiostart").play();
|
||||
console.log(document.activeElement);
|
||||
document.activeElement.click();
|
||||
}
|
||||
if(sex3.code === "KeyS" && i+3 < prvnihra.length){
|
||||
document.getElementById("Switchfocus").play();
|
||||
console.log(i);
|
||||
i = i+3;
|
||||
prvnihra[i].focus();
|
||||
}
|
||||
if(sex3.code === "KeyW" && i-3 >= 0){
|
||||
document.getElementById("Switchfocus").play();
|
||||
console.log(i);
|
||||
i = i-3;
|
||||
prvnihra[i].focus();
|
||||
}
|
||||
document.body.requestFullscreen();
|
||||
//document.body.requestFullscreen();
|
||||
})
|
||||
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue