Skip to content

customizations #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ body {
}
}

#balance {
color: rgb(233, 192, 192);
}

#reels {
display: flex;
width: 100vw;
Expand Down Expand Up @@ -53,6 +57,10 @@ body {
padding: 5px 30px;
}

#controls button {
border: 1px solid rgba(0, 0, 0, 0.4);
width: 120px;
}
#controls label {
display: flex;
align-items: center;
Expand Down
9 changes: 8 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
</head>
<body>
<div id="slot">
<div id="jackpot">Jackpot: <span id="jp">5.555.555</span></div>
<div id="balance">Balance: <span id="bl">10.000$</span></div>

<div id="jackpot">Jackpot: <span id="jp">0</span></div>
<div id="reels">
<div class="reel"></div>
<div class="reel"></div>
Expand All @@ -19,6 +21,11 @@
</div>
<div id="controls">
<button type="button" id="spin">SPIN</button>
<h3>Bet:</h3>
<button type="button" id="bt_10">10%</button>
<button type="button" id="bt_25">25%</button>
<button type="button" id="bt_50">50%</button>
<button type="button" id="bt_100">100%</button>
<label>
<input type="checkbox" name="autoplay" id="autoplay" />
Autoplay
Expand Down
2 changes: 1 addition & 1 deletion src/js/Reel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class Reel {
}

get factor() {
return 1 + Math.pow(this.idx / 2, 2);
return 1 + Math.pow(this.idx / 1.5, 2);
}

renderSymbols(nextSymbols) {
Expand Down
35 changes: 35 additions & 0 deletions src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,39 @@ const config = {
},
};

let INIT_BALANCE = 500;
let CURRENT_BET = 0;

const balanceElement = document.querySelector("#balance #bl");
balanceElement.innerHTML = INIT_BALANCE;

function initValue() {
const buttons = document.querySelectorAll("button");

// Add click event listener to each button
buttons.forEach((button) => {
button.addEventListener("click", () => {
console.log("Button clicked:", button.id);

switch (button.id) {
case "bt_10":
CURRENT_BET = INIT_BALANCE * 0.1;
break;
case "bt_25":
CURRENT_BET = (INIT_BALANCE * 25) / 100;
break;
case "bt_50":
CURRENT_BET = INIT_BALANCE / 2;
break;
case "bt_100":
CURRENT_BET = INIT_BALANCE;
break;
}
console.log("current bet: ", CURRENT_BET);
});
});
}

initValue();

const slot = new Slot(document.getElementById("slot"), config);