-2
Hello! I am developing a little game in Java Script, but I am with a difficulty in the moment that the player buys a coins bonus, it will replace a value in another function, for when it is activated, the player instead of winning 1 point, will earn 2 points. But inflictly, I can’t make the variable ${money}, worth 2 points instead of 1, and that goes for the other two bonuses you have in the game! Any help or assistance is of great value! Follow the code:
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Clique para ganhar!</title>
<style>
body{
background-color: rgb(12, 12, 136);
margin: 25px;
}
h1{
text-align: center;
font-family: 'Lexend Mega', sans-serif;
}
form{
background-color: white;
}
div{
text-align: center;
}
#clqg{
margin: 10px;
padding: 15px 15px;
font-family: 'Happy Monkey', cursive;
font-size: large;
}
.buyling{
padding: 10px 0px 0px;
}
.title{
font-size: xx-large;
font-family: 'Lexend Mega', sans-serif;
}
.btnbuy{
margin: 15px;
}
</style>
</head>
<body>
<h1>Clique, Ganhe, Vença!</h1>
<div id="titleex">
<form>
<div id="money" class="title"></div>
<input type="button" id="clqg" value="Ganhar!" onclick="button()">
<div class="buyling" id="btnone">
Bonús: 75$
<input type="button" class="btnbuy" value="Comprar" onclick="buyone()">
</diV>
<div id="btntwo">
Híper bonús: 125$
<input type="button" class="btnbuy" value="Comprar" onclick="buytwo()">
</div>
<div id="btn3">
Ultimate final: 1000$
<input type="button" class="btnbuy" value="Comprar" onclick="buythree()">
</div>
</form>
</div>
<script>var txt = document.getElementById('money') // div onde vai o valor da moeda //
var money = Number(0) // valor da moeda inicial = 0 //
function button() {
money += 1
txt.innerHTML = `Seu saldo é igual a <strong>${money}$</strong>`
if (){
money += 2
} // aqui vai o botão de ganahr $ //
}
function buyone(){
var btn1 = document.getElementById("btnone")
if (money >= 75){
btn1.innerHTML = `Comprado!`
var m1 =
}else {
window.alert('Seu saldo é insuficiente!')
} // aqui vai a opção de comprar o dobro de $ //
}
function buytwo(){
var btn2 = document.getElementById('btntwo')
if(money >= 125){
money += 4
btn2.innerHTML = `Comprado!`
} else{
window.alert("Seu saldo é insuficiente!")
} // opção de dobrar os pontos //
}
function buythree(){
var btn3 = document.getElementById('titleex')
if (money >= 1000){
btn3.innerHTML = `Parabens, você ganhou!`
}
} // aqui se zera o game //
</script>
</body>
</html>```
Thank you very much boy!!
– Matheus Gambaro