mirror of
https://github.com/danbulant/arcade-machine
synced 2026-06-20 23:11:04 +00:00
Changed audio to be in JS instead of HTML
This commit is contained in:
parent
4c40c19b3b
commit
8e651ce856
1 changed files with 12 additions and 8 deletions
|
|
@ -41,12 +41,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<audio id="Switchfocus">
|
<!-- <audio id="Switchfocus">
|
||||||
<source src="Audio/switchfocus.mp3" type="audio/mpeg">
|
<source src="Audio/switchfocus.mp3" type="audio/mpeg">
|
||||||
</audio>
|
</audio>
|
||||||
<audio id="Audiostart">
|
<audio id="Audiostart">
|
||||||
<source src="Audio/audiostart.mp3" type="audio/mpeg">
|
<source src="Audio/audiostart.mp3" type="audio/mpeg">
|
||||||
</audio>
|
</audio> -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const prvnihra = [...document.querySelectorAll("button")]
|
const prvnihra = [...document.querySelectorAll("button")]
|
||||||
|
|
@ -58,10 +58,12 @@
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
var i = 0;
|
var i = 0;
|
||||||
|
const switchfocus = new Audio("Audio/switchfocus.mp3");
|
||||||
|
const startaudio = new Audio ("Audio/audiostart.mp3")
|
||||||
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();
|
switchfocus.play();
|
||||||
i++;
|
i++;
|
||||||
prvnihra[i].focus();
|
prvnihra[i].focus();
|
||||||
console.log("right", i);
|
console.log("right", i);
|
||||||
|
|
@ -70,7 +72,7 @@
|
||||||
})
|
})
|
||||||
document.addEventListener("keydown",function(sex3){
|
document.addEventListener("keydown",function(sex3){
|
||||||
if(sex3.code === "KeyA"){
|
if(sex3.code === "KeyA"){
|
||||||
document.getElementById("Switchfocus").play();
|
switchfocus.play();
|
||||||
if(i<=0) i=prvnihra.length
|
if(i<=0) i=prvnihra.length
|
||||||
i--;
|
i--;
|
||||||
prvnihra[i].focus()
|
prvnihra[i].focus()
|
||||||
|
|
@ -78,18 +80,18 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
if (sex3.code === "KeyE"){
|
if (sex3.code === "KeyE"){
|
||||||
document.getElementById("Audiostart").play();
|
startaudio.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();
|
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();
|
switchfocus.play();
|
||||||
console.log(i);
|
console.log(i);
|
||||||
i = i-3;
|
i = i-3;
|
||||||
prvnihra[i].focus();
|
prvnihra[i].focus();
|
||||||
|
|
@ -105,7 +107,6 @@
|
||||||
console.log("promenna",vers);
|
console.log("promenna",vers);
|
||||||
switch (vers) {
|
switch (vers) {
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
execFile(AsphyxiaPath);
|
execFile(AsphyxiaPath);
|
||||||
execFile(SDVX3Path);
|
execFile(SDVX3Path);
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
|
|
@ -127,6 +128,9 @@
|
||||||
exec("taskkill /im " + browser)
|
exec("taskkill /im " + browser)
|
||||||
},1200)
|
},1200)
|
||||||
break;
|
break;
|
||||||
|
case 6:
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue