
klik untuk menyalin
👇
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Slot Ultimate</title>
<style>
body{
background:linear-gradient(135deg,#0f172a,#020617);
color:#fff;
font-family:sans-serif;
text-align:center;
}
.slot-container{
display:grid;
grid-template-columns:repeat(5,60px);
gap:8px;
justify-content:center;
margin:15px auto;
}
.cell{
width:60px;
height:60px;
background:#1e293b;
border-radius:12px;
display:flex;
align-items:center;
justify-content:center;
font-size:28px;
position:relative;
}
.win{
box-shadow:0 0 15px #22c55e;
transform:scale(1.1);
}
.win-text{
position:absolute;
top:-10px;
font-size:12px;
color:#22c55e;
animation:pop 1s forwards;
}
@keyframes pop{
0%{opacity:0;transform:translateY(10px);}
50%{opacity:1;}
100%{opacity:0;transform:translateY(-20px);}
}
button{
padding:10px 20px;
border:none;
border-radius:10px;
background:#22c55e;
color:#fff;
}
select,input{
padding:5px;
border-radius:5px;
border:none;
}
</style>
</head>
<body>
<h2>🎰 SLOT ULTIMATE</h2>
<p>Saldo: <span id="saldo">10000</span> | Free Spin: <span id="free">0</span></p>
Bet:
<select id="bet">
<option>50</option>
<option>100</option>
<option>200</option>
<option>500</option>
<option>1000</option>
</select>
RTP: <input type="number" id="rtp" value="90">
<div class="slot-container" id="slot"></div>
<button onclick="spin()">SPIN</button>
<p id="info"></p>
<script>
const symbols = ["🍒","🍋","🍉","⭐","💎"];
let saldo = 10000;
let totalBet = 0;
let totalWin = 0;
let freeSpin = 0;
const slot = document.getElementById("slot");
// PAYTABLE
let paytable = {
"🍒": {3:2,4:4,5:6},
"🍋": {3:3,4:5,5:8},
"🍉": {3:4,4:6,5:10},
"⭐": {3:6,4:10,5:15},
"💎": {3:10,4:20,5:40}
};
// RANDOM (SCATTER JARANG)
function randomSymbol(){
let r = Math.random();
if(r < 0.08) return "🔥"; // scatter hanya 8%
return symbols[Math.floor(Math.random()*symbols.length)];
}
// INIT
function init(){
slot.innerHTML="";
for(let i=0;i<20;i++){
let d=document.createElement("div");
d.className="cell";
d.innerText=randomSymbol();
slot.appendChild(d);
}
}
init();
function spin(){
let bet = parseInt(document.getElementById("bet").value);
let rtp = document.getElementById("rtp").value/100;
if(freeSpin <= 0){
if(saldo < bet){ alert("Saldo habis"); return; }
saldo -= bet;
totalBet += bet;
}
if(freeSpin > 0) freeSpin--;
let cells = document.querySelectorAll(".cell");
let anim = setInterval(()=>{
cells.forEach(c=>c.innerText=randomSymbol());
},80);
setTimeout(()=>{
clearInterval(anim);
let final=[];
cells.forEach(c=>{
let s=randomSymbol();
c.innerText=s;
c.classList.remove("win");
c.innerHTML=s;
final.push(s);
});
let win=0;
// SCATTER HITUNG
let scatter = final.filter(s=>s==="🔥").length;
if(scatter >= 3){
freeSpin += 10;
document.getElementById("info").innerText="🔥 FREE SPIN +10!";
}
// === LOGIKA MENANG FIX ===
let symbolsToCheck = ["🍒","🍋","🍉","⭐","💎"];
symbolsToCheck.forEach(sym=>{
let cols = [false,false,false,false,false];
let positions = [];
final.forEach((v,i)=>{
if(v === sym){
let col = i % 5;
cols[col] = true;
positions.push(i);
}
});
let count = 0;
for(let i=0;i<5;i++){
if(cols[i]){
count++;
}else{
break;
}
}
if(count >= 3){
let multi = paytable[sym][count];
let winAmount = bet * multi;
win += winAmount;
positions.forEach(i=>{
let col = i % 5;
if(col < count){
let el = cells[i];
el.classList.add("win");
let txt = document.createElement("div");
txt.className="win-text";
txt.innerText="+"+(winAmount/count);
el.appendChild(txt);
}
});
}
});
// RTP CONTROL
let currentRTP = totalWin / totalBet;
if(currentRTP < rtp){
win *= 1.3;
}else{
win *= 0.7;
}
win = Math.floor(win);
saldo += win;
totalWin += win;
document.getElementById("saldo").innerText = saldo;
document.getElementById("free").innerText = freeSpin;
document.getElementById("info").innerText =
win > 0 ? "MENANG "+win : "COBA LAGI";
},1000);
}
</script>
</body>
</html>
Komentar untuk Script Demo slot
Posting Komentar