|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Modi vs Kejriwal Cricket Battle</title> |
|
<style> |
|
* { |
|
margin: 0; |
|
padding: 0; |
|
box-sizing: border-box; |
|
} |
|
|
|
body { |
|
font-family: 'Arial', sans-serif; |
|
background: linear-gradient(to right, #ff9933, #ffffff, #138808); |
|
height: 100vh; |
|
overflow: hidden; |
|
display: flex; |
|
justify-content: center; |
|
align-items: center; |
|
position: relative; |
|
} |
|
|
|
#gameCanvas { |
|
background-color: #1e8449; |
|
border: 10px solid #800080; |
|
border-radius: 15px; |
|
box-shadow: 0 0 40px rgba(0, 0, 0, 0.6); |
|
} |
|
|
|
#scoreboard { |
|
position: absolute; |
|
top: 20px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
color: white; |
|
font-size: 28px; |
|
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8); |
|
padding: 15px 30px; |
|
background: rgba(0, 0, 0, 0.7); |
|
border-radius: 15px; |
|
border: 3px solid gold; |
|
font-weight: bold; |
|
} |
|
|
|
#gameOver { |
|
position: absolute; |
|
top: 50%; |
|
left: 50%; |
|
transform: translate(-50%, -50%); |
|
color: white; |
|
font-size: 60px; |
|
text-align: center; |
|
display: none; |
|
text-shadow: 5px 5px 10px rgba(0, 0, 0, 0.9); |
|
background: rgba(139, 0, 0, 0.9); |
|
padding: 40px; |
|
border-radius: 25px; |
|
border: 5px solid #ffd700; |
|
z-index: 100; |
|
} |
|
|
|
#restartBtn { |
|
margin-top: 30px; |
|
padding: 15px 30px; |
|
font-size: 28px; |
|
background: linear-gradient(to right, #ff9933, #ffffff, #138808); |
|
border: 3px solid #000080; |
|
border-radius: 15px; |
|
cursor: pointer; |
|
box-shadow: 0 0 20px rgba(255, 255, 255, 0.7); |
|
transition: all 0.3s; |
|
font-weight: bold; |
|
} |
|
|
|
#restartBtn:hover { |
|
transform: scale(1.1); |
|
box-shadow: 0 0 30px rgba(255, 255, 255, 0.9); |
|
} |
|
|
|
#controls { |
|
position: absolute; |
|
bottom: 30px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
color: white; |
|
font-size: 22px; |
|
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8); |
|
text-align: center; |
|
background: rgba(0, 0, 0, 0.7); |
|
padding: 15px; |
|
border-radius: 15px; |
|
border: 3px solid #ff0000; |
|
} |
|
|
|
#title { |
|
position: absolute; |
|
top: -70px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
color: #000080; |
|
font-size: 40px; |
|
text-shadow: 3px 3px 6px rgba(255, 255, 255, 0.7); |
|
font-weight: bold; |
|
white-space: nowrap; |
|
} |
|
|
|
|
|
.crowd { |
|
position: absolute; |
|
bottom: 0; |
|
width: 100%; |
|
height: 20%; |
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><circle cx="10" cy="10" r="5" fill="%23fff"/><circle cx="30" cy="8" r="4" fill="%23ff9933"/><circle cx="50" cy="12" r="5" fill="%23fff"/><circle cx="70" cy="9" r="4" fill="%23138808"/><circle cx="90" cy="11" r="5" fill="%23fff"/></svg>'); |
|
background-repeat: repeat-x; |
|
opacity: 0.6; |
|
z-index: -1; |
|
} |
|
|
|
.speech-bubble { |
|
position: absolute; |
|
background: white; |
|
border-radius: 20px; |
|
padding: 10px 15px; |
|
font-size: 14px; |
|
color: black; |
|
text-align: center; |
|
box-shadow: 2px 2px 4px rgba(0,0,0,0.2); |
|
display: none; |
|
white-space: nowrap; |
|
z-index: 10; |
|
} |
|
|
|
.bubble-bat { |
|
bottom: 100px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
} |
|
|
|
.bubble-ball { |
|
top: 150px; |
|
left: 50%; |
|
transform: translateX(-50%); |
|
} |
|
</style> |
|
</head> |
|
<body> |
|
<div id="title">Modi Cricket Bat vs Kejriwal Ball</div> |
|
<div class="crowd"></div> |
|
<canvas id="gameCanvas"></canvas> |
|
<div id="scoreboard">π Score: 0 | π³ Balls: 0 | β‘ Speed: 1x</div> |
|
<div id="gameOver"> |
|
<h1>Game Over!</h1> |
|
<p id="finalScore" style="font-size: 36px; margin: 20px 0;">Your score: 0</p> |
|
<button id="restartBtn">π© Play Again</button> |
|
</div> |
|
<div id="controls">πΉοΈ Use <strong>LEFT β</strong> and <strong>RIGHT β</strong> arrow keys to move</div> |
|
|
|
|
|
<div class="speech-bubble bubble-bat" id="modiSpeech">Mitron!</div> |
|
<div class="speech-bubble bubble-ball" id="kejriwalSpeech">Kya bekaar bowling hai!</div> |
|
|
|
<script> |
|
const canvas = document.getElementById('gameCanvas'); |
|
const ctx = canvas.getContext('2d'); |
|
const scoreboard = document.getElementById('scoreboard'); |
|
const gameOverScreen = document.getElementById('gameOver'); |
|
const finalScore = document.getElementById('finalScore'); |
|
const restartBtn = document.getElementById('restartBtn'); |
|
const modiSpeech = document.getElementById('modiSpeech'); |
|
const kejriwalSpeech = document.getElementById('kejriwalSpeech'); |
|
|
|
|
|
canvas.width = 800; |
|
canvas.height = 600; |
|
|
|
|
|
let score = 0; |
|
let ballsFaced = 0; |
|
let gameActive = false; |
|
let gameSpeed = 1; |
|
let lastDirection = 'right'; |
|
|
|
|
|
const bat = { |
|
x: canvas.width / 2 - 75, |
|
y: canvas.height - 40, |
|
width: 150, |
|
height: 30, |
|
speed: 15 |
|
}; |
|
|
|
|
|
const ball = { |
|
x: 0, |
|
y: 0, |
|
radius: 20, |
|
speedX: 0, |
|
speedY: 0, |
|
active: false |
|
}; |
|
|
|
|
|
const scams = [ |
|
"Liquor Scam", "CS Bus Scam", "Water Tanker Scam", |
|
"PWD Scam", "Excise Scam", "Classroom Scam", |
|
"Hospitals Scam", "Mohalla Clinics", "DJB Scam", |
|
"Wifi Scam", "Waste Mgmt Scam", "Electricity Scam" |
|
]; |
|
|
|
const brickRowCount = 3; |
|
const brickColumnCount = 4; |
|
const brickWidth = 170; |
|
const brickHeight = 35; |
|
const brickPadding = 15; |
|
const brickOffsetTop = 80; |
|
const brickOffsetLeft = 60; |
|
|
|
const bricks = []; |
|
for (let c = 0; c < brickColumnCount; c++) { |
|
bricks[c] = []; |
|
for (let r = 0; r < brickRowCount; r++) { |
|
const scamIndex = (c * brickRowCount + r) % scams.length; |
|
bricks[c][r] = { |
|
x: 0, |
|
y: 0, |
|
status: 1, |
|
scam: scams[scamIndex] |
|
}; |
|
} |
|
} |
|
|
|
|
|
const modiFrames = [ |
|
"π", "π", "π€©", "π", "π‘", "π€¬", "π", "π€" |
|
]; |
|
let currentModiFrame = 0; |
|
let frameCounter = 0; |
|
|
|
|
|
const kejriwalFrames = [ |
|
"π", "π", "π²", "π¨", "π΅", "π€", "π·", "π₯΅" |
|
]; |
|
let currentKejriwalFrame = 0; |
|
|
|
|
|
const sounds = { |
|
hit: ["Mann ki baat", "Mitron!", "Achhe din!", "Sabka saath sabka vikas!"], |
|
miss: ["Main bhagwan ka diya hua PM hun!", "Inhe kuchh nahi aata!", "Besharmi ki hadd hai!"] |
|
}; |
|
|
|
|
|
function init() { |
|
score = 0; |
|
ballsFaced = 0; |
|
gameActive = true; |
|
gameSpeed = 1; |
|
|
|
|
|
bat.x = canvas.width / 2 - bat.width / 2; |
|
|
|
|
|
for (let c = 0; c < brickColumnCount; c++) { |
|
for (let r = 0; r < brickRowCount; r++) { |
|
bricks[c][r].status = 1; |
|
} |
|
} |
|
|
|
|
|
resetBall(); |
|
|
|
|
|
gameOverScreen.style.display = 'none'; |
|
modiSpeech.style.display = 'none'; |
|
kejriwalSpeech.style.display = 'none'; |
|
|
|
|
|
requestAnimationFrame(gameLoop); |
|
} |
|
|
|
|
|
function resetBall() { |
|
ball.x = canvas.width / 2; |
|
ball.y = 50; |
|
ball.speedX = (Math.random() * 6 - 3) * gameSpeed; |
|
ball.speedY = 3 * gameSpeed; |
|
ball.active = true; |
|
ballsFaced++; |
|
currentKejriwalFrame = Math.floor(Math.random() * kejriwalFrames.length); |
|
updateScoreboard(); |
|
} |
|
|
|
|
|
function showSpeech(bubble, text) { |
|
bubble.textContent = text; |
|
bubble.style.display = 'block'; |
|
setTimeout(() => { |
|
bubble.style.display = 'none'; |
|
}, 1000); |
|
} |
|
|
|
|
|
function drawBat() { |
|
|
|
ctx.fillStyle = '#FF9933'; |
|
ctx.fillRect(bat.x, bat.y, bat.width/3, bat.height); |
|
ctx.fillStyle = '#FFFFFF'; |
|
ctx.fillRect(bat.x + bat.width/3, bat.y, bat.width/3, bat.height); |
|
ctx.fillStyle = '#138808'; |
|
ctx.fillRect(bat.x + 2*bat.width/3, bat.y, bat.width/3, bat.height); |
|
|
|
|
|
ctx.strokeStyle = '#000080'; |
|
ctx.lineWidth = 3; |
|
ctx.strokeRect(bat.x, bat.y, bat.width, bat.height); |
|
|
|
|
|
const faceRadius = 25; |
|
const faceX = lastDirection === 'right' ? bat.x + bat.width - 10 : bat.x + 10; |
|
|
|
|
|
ctx.fillStyle = '#ffcc00'; |
|
ctx.beginPath(); |
|
ctx.arc(faceX, bat.y - faceRadius/2, faceRadius, 0, Math.PI * 2); |
|
ctx.fill(); |
|
ctx.strokeStyle = '#000'; |
|
ctx.lineWidth = 2; |
|
ctx.stroke(); |
|
|
|
|
|
ctx.fillStyle = '#000'; |
|
ctx.beginPath(); |
|
ctx.arc(faceX - 10, bat.y - faceRadius/2 - 5, 3, 0, Math.PI * 2); |
|
ctx.fill(); |
|
ctx.beginPath(); |
|
ctx.arc(faceX + 10, bat.y - faceRadius/2 - 5, 3, 0, Math.PI * 2); |
|
ctx.fill(); |
|
|
|
|
|
ctx.font = '20px Arial'; |
|
ctx.fillText(modiFrames[currentModiFrame], faceX - 10, bat.y - faceRadius/2 + 15); |
|
|
|
|
|
frameCounter++; |
|
if (frameCounter % 10 === 0) { |
|
currentModiFrame = (currentModiFrame + 1) % modiFrames.length; |
|
} |
|
|
|
|
|
ctx.font = 'bold 16px Arial'; |
|
ctx.fillStyle = '#000080'; |
|
ctx.fillText("Narendra Modi", bat.x + bat.width/2 - 50, bat.y - 5); |
|
} |
|
|
|
|
|
function drawBall() { |
|
|
|
ctx.fillStyle = '#009688'; |
|
ctx.beginPath(); |
|
ctx.arc(ball.x, ball.y, ball.radius, 0, Math.PI * 2); |
|
ctx.fill(); |
|
ctx.strokeStyle = '#000'; |
|
ctx.lineWidth = 2; |
|
ctx.stroke(); |
|
|
|
|
|
ctx.font = '20px Arial'; |
|
ctx.fillText(kejriwalFrames[currentKejriwalFrame], ball.x - 10, ball.y + 5); |
|
|
|
|
|
ctx.font = 'bold 14px Arial'; |
|
ctx.fillStyle = '#000'; |
|
ctx.fillText("Kejriwal", ball.x - 25, ball.y - 15); |
|
|
|
|
|
if (ball.y + ball.radius > canvas.height - 100) { |
|
currentKejriwalFrame = Math.floor(Math.random() * kejriwalFrames.length); |
|
} |
|
} |
|
|
|
|
|
function drawBricks() { |
|
for (let c = 0; c < brickColumnCount; c++) { |
|
for (let r = 0; r < brickRowCount; r++) { |
|
if (bricks[c][r].status === 1) { |
|
const brickX = c * (brickWidth + brickPadding) + brickOffsetLeft; |
|
const brickY = r * (brickHeight + brickPadding) + brickOffsetTop; |
|
bricks[c][r].x = brickX; |
|
bricks[c][r].y = brickY; |
|
|
|
|
|
let brickColor; |
|
switch (r) { |
|
case 0: brickColor = '#800000'; break; |
|
case 1: brickColor = '#4169E1'; break; |
|
case 2: brickColor = '#8B4513'; break; |
|
default: brickColor = '#000000'; |
|
} |
|
|
|
ctx.fillStyle = brickColor; |
|
ctx.fillRect(brickX, brickY, brickWidth, brickHeight); |
|
|
|
|
|
ctx.fillStyle = 'rgba(0, 0, 0, 0.3)'; |
|
ctx.fillRect(brickX + 5, brickY + 5, brickWidth, brickHeight); |
|
|
|
ctx.strokeStyle = '#000'; |
|
ctx.lineWidth = 1; |
|
ctx.strokeRect(brickX, brickY, brickWidth, brickHeight); |
|
|
|
|
|
ctx.font = 'bold 12px Arial'; |
|
ctx.fillStyle = '#fff'; |
|
const scam = bricks[c][r].scam; |
|
const maxLength = 15; |
|
if (scam.length > maxLength) { |
|
|
|
const words = scam.split(' '); |
|
let line1 = '', line2 = ''; |
|
for (const word of words) { |
|
if ((line1 + word).length <= maxLength) { |
|
line1 += word + ' '; |
|
} else { |
|
line2 += word + ' '; |
|
} |
|
} |
|
ctx.fillText(line1.trim(), brickX + 5, brickY + 15); |
|
ctx.fillText(line2.trim(), brickX + 5, brickY + 30); |
|
} else { |
|
ctx.fillText(scam, brickX + 5, brickY + 20); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
function updateScoreboard() { |
|
scoreboard.textContent = `π Score: ${score} | π³ Balls: ${ballsFaced} | β‘ Speed: ${gameSpeed.toFixed(1)}x`; |
|
} |
|
|
|
|
|
function collisionDetection() { |
|
for (let c = 0; c < brickColumnCount; c++) { |
|
for (let r = 0; r < brickRowCount; r++) { |
|
const brick = bricks[c][r]; |
|
if (brick.status === 1) { |
|
if ( |
|
ball.x + ball.radius > brick.x && |
|
ball.x - ball.radius < brick.x + brickWidth && |
|
ball.y + ball.radius > brick.y && |
|
ball.y - ball.radius < brick.y + brickHeight |
|
) { |
|
ball.speedY = -ball.speedY; |
|
brick.status = 0; |
|
score += (brickRowCount - r + 1) * 50; |
|
|
|
|
|
const randomHitPhrase = sounds.hit[Math.floor(Math.random() * sounds.hit.length)]; |
|
showSpeech(modiSpeech, randomHitPhrase); |
|
|
|
|
|
modiSpeech.style.left = `${bat.x + bat.width/2}px`; |
|
modiSpeech.style.bottom = `${canvas.height - bat.y + 30}px`; |
|
|
|
currentKejriwalFrame = Math.min(kejriwalFrames.length - 1, currentKejriwalFrame + 1); |
|
updateScoreboard(); |
|
|
|
|
|
let allBricksCleared = true; |
|
for (let c = 0; c < brickColumnCount; c++) { |
|
for (let r = 0; r < brickRowCount; r++) { |
|
if (bricks[c][r].status === 1) { |
|
allBricksCleared = false; |
|
break; |
|
} |
|
} |
|
if (!allBricksCleared) break; |
|
} |
|
|
|
if (allBricksCleared) { |
|
gameSpeed += 0.5; |
|
|
|
currentModiFrame = 2; |
|
setTimeout(() => currentModiFrame = 0, 500); |
|
resetBricks(); |
|
showSpeech(modiSpeech, "Mera Bharat Mahan!"); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
|
|
function resetBricks() { |
|
for (let c = 0; c < brickColumnCount; c++) { |
|
for (let r = 0; r < brickRowCount; r++) { |
|
bricks[c][r].status = 1; |
|
} |
|
} |
|
} |
|
|
|
|
|
function gameLoop() { |
|
if (!gameActive) return; |
|
|
|
|
|
ctx.fillStyle = 'rgba(30, 132, 73, 0.2)'; |
|
ctx.fillRect(0, 0, canvas.width, canvas.height); |
|
|
|
|
|
drawBricks(); |
|
drawBat(); |
|
drawBall(); |
|
|
|
|
|
if (ball.active) { |
|
ball.x += ball.speedX; |
|
ball.y += ball.speedY; |
|
|
|
|
|
if (ball.x + ball.radius > canvas.width || ball.x - ball.radius < 0) { |
|
ball.speedX = -ball.speedX; |
|
currentKejriwalFrame = Math.floor(Math.random() * kejriwalFrames.length); |
|
} |
|
|
|
if (ball.y - ball.radius < 0) { |
|
ball.speedY = -ball.speedY; |
|
currentKejriwalFrame = Math.floor(Math.random() * kejriwalFrames.length); |
|
} |
|
|
|
|
|
if ( |
|
ball.y + ball.radius > bat.y && |
|
ball.x > bat.x && |
|
ball.x < bat.x + bat.width |
|
) { |
|
|
|
currentModiFrame = 6; |
|
setTimeout(() => currentModiFrame = 0, 200); |
|
|
|
|
|
showSpeech(modiSpeech, "Mitron!"); |
|
modiSpeech.style.left = `${bat.x + bat.width/2}px`; |
|
modiSpeech.style.bottom = `${canvas.height - bat.y + 30}px`; |
|
|
|
|
|
const hitPoint = (ball.x - (bat.x + bat.width/2)) / (bat.width/2); |
|
ball.speedX = hitPoint * 7 * gameSpeed; |
|
ball.speedY = -Math.abs(ball.speedY); |
|
|
|
|
|
score += 10; |
|
updateScoreboard(); |
|
} |
|
|
|
|
|
if (ball.y - ball.radius > canvas.height) { |
|
ball.active = false; |
|
|
|
|
|
currentModiFrame = 4; |
|
|
|
|
|
const randomMissPhrase = sounds.miss[Math.floor(Math.random() * sounds.miss.length)]; |
|
showSpeech(kejriwalSpeech, randomMissPhrase); |
|
kejriwalSpeech.style.left = `${ball.x}px`; |
|
kejriwalSpeech.style.top = `${ball.y - 50}px`; |
|
|
|
|
|
if (ballsFaced >= 3) { |
|
gameOver(); |
|
} else { |
|
setTimeout(() => { |
|
currentModiFrame = 0; |
|
resetBall(); |
|
}, 1000); |
|
} |
|
} |
|
|
|
|
|
collisionDetection(); |
|
} |
|
|
|
requestAnimationFrame(gameLoop); |
|
} |
|
|
|
|
|
function gameOver() { |
|
gameActive = false; |
|
finalScore.textContent = `Your score: ${score}`; |
|
|
|
|
|
let message = "Try Again!"; |
|
if (score > 1500) message = "Supreme Leader! π"; |
|
else if (score > 1000) message = "56-inch Performance! π"; |
|
else if (score > 500) message = "Good Effort Mitron! π"; |
|
|
|
document.querySelector("#gameOver p").textContent = `Your score: ${score} - ${message}`; |
|
gameOverScreen.style.display = 'block'; |
|
} |
|
|
|
|
|
const keys = { |
|
ArrowLeft: false, |
|
ArrowRight: false |
|
}; |
|
|
|
document.addEventListener('keydown', (e) => { |
|
if (e.key in keys) { |
|
keys[e.key] = true; |
|
lastDirection = e.key === 'ArrowLeft' ? 'left' : 'right'; |
|
e.preventDefault(); |
|
} |
|
|
|
|
|
if (e.key === ' ' && !gameActive) { |
|
init(); |
|
} |
|
|
|
|
|
if (e.key === 'Enter' && !gameActive) { |
|
init(); |
|
} |
|
}); |
|
|
|
document.addEventListener('keyup', (e) => { |
|
if (e.key in keys) { |
|
keys[e.key] = false; |
|
e.preventDefault(); |
|
} |
|
}); |
|
|
|
|
|
function handleBatMovement() { |
|
if (keys.ArrowLeft && bat.x > 0) { |
|
bat.x -= bat.speed; |
|
} |
|
if (keys.ArrowRight && bat.x < canvas.width - bat.width) { |
|
bat.x += bat.speed; |
|
} |
|
} |
|
|
|
|
|
restartBtn.addEventListener('click', init); |
|
|
|
|
|
setInterval(handleBatMovement, 16); |
|
|
|
|
|
document.addEventListener('keydown', function firstKeyPress() { |
|
init(); |
|
document.removeEventListener('keydown', firstKeyPress); |
|
}); |
|
|
|
|
|
gameOverScreen.style.display = 'block'; |
|
finalScore.textContent = "Press any key to start"; |
|
document.querySelector("#gameOver h1").textContent = "Modi vs Kejriwal"; |
|
document.querySelector("#gameOver p").textContent = "Use LEFT and RIGHT arrow keys to defend India!"; |
|
</script> |
|
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">This website has been generated by <a href="https://enzostvs-deepsite.hf.space" style="color: #fff;" target="_blank" >DeepSite</a> <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;"></p></body> |
|
</html> |