<?php
// Gelişmiş Mini Agar.io - Tek Dosya (Hileler, Sprint, Zoom, Zeki Botlar)
?>
<!DOCTYPE html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>VIP Agar.io (Hileli & Gelişmiş)</title>
<style>
body { margin: 0; overflow: hidden; background-color: #1a1a1a; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; user-select: none; }
canvas { display: block; }
#uiLayer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
/* Skor ve Liderlik Tablosu */
#scoreBoard { position: absolute; top: 15px; left: 15px; color: #fff; font-size: 20px; background: rgba(0, 0, 0, 0.6); padding: 10px 20px; border-radius: 8px; font-weight: bold; border-left: 4px solid #2ecc71; }
#leaderboard { position: absolute; top: 15px; right: 15px; width: 200px; color: #fff; background: rgba(0, 0, 0, 0.6); padding: 15px; border-radius: 8px; border-top: 4px solid #f1c40f; }
#leaderboard h3 { margin: 0 0 10px 0; text-align: center; font-size: 18px; color: #f1c40f; border-bottom: 1px solid rgba(255,255,255,0.2); padding-bottom: 5px; }
#leaderboard ol { margin: 0; padding-left: 25px; font-size: 14px; }
#leaderboard li { margin-bottom: 5px; }
.highlight { color: #2ecc71; font-weight: bold; text-shadow: 0 0 5px #2ecc71; }
/* Minimap */
#minimap-container { position: absolute; bottom: 15px; right: 15px; width: 150px; height: 150px; background: rgba(0,0,0,0.7); border: 2px solid #555; border-radius: 8px; overflow: hidden; }
#minimap { width: 100%; height: 100%; }
/* Oyun Sonu Ekranı */
#gameOver { display: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; text-align: center; background: rgba(0, 0, 0, 0.95); padding: 40px; border-radius: 15px; pointer-events: auto; box-shadow: 0 0 30px rgba(231, 76, 60, 0.5); }
button { padding: 12px 25px; font-size: 18px; cursor: pointer; border: none; border-radius: 5px; background-color: #2ecc71; color: white; font-weight: bold; transition: 0.2s; }
button:hover { background-color: #27ae60; transform: scale(1.05); }
/* Kontroller & Hileler Bilgisi */
#controls { position: absolute; bottom: 15px; left: 15px; color: rgba(255,255,255,0.8); font-size: 13px; background: rgba(0,0,0,0.6); padding: 15px; border-radius: 8px; border-left: 4px solid #3498db; }
#controls span { color: #e74c3c; font-weight: bold; }
</style>
</head>
<body>
<div id="uiLayer">
<div id="scoreBoard">Kütle: <span id="score" style="color:#2ecc71;">20</span></div>
<div id="leaderboard">
<h3>Liderlik Tablosu</h3>
<ol id="lb-list"></ol>
</div>
<div id="minimap-container">
<canvas id="minimap"></canvas>
</div>
<div id="controls">
<b>🔥 NORMAL KONTROLLER</b><br>
<b>Fare:</b> Yönlendirme<br>
<b>Fare Tekerleği:</b> Kamera Zoom<br>
<b>Boşluk:</b> Bölünme<br>
<b>W:</b> Yem Fırlatma<br>
<b>Shift (Basılı Tut):</b> Depar At (Kütle Yakar)<br>
<hr style="border:1px solid rgba(255,255,255,0.1); margin: 8px 0;">
<b>👑 SANA ÖZEL HİLELER</b><br>
<b>1:</b> +50 Kütle Ekle<br>
<b>2:</b> Fareye Işınlan<br>
<b>3:</b> Tüm Virüsleri Yut<br>
<b>4:</b> Botları Dondur & Küçült
</div>
<div id="gameOver">
<h1 style="color:#e74c3c; margin-top:0;">Oyun Bitti!</h1>
<p>Maalesef yutuldun patron.</p>
<button onclick="restartGame()">Yeniden Başla</button>
</div>
</div>
<canvas id="gameCanvas"></canvas>
<script>
const canvas = document.getElementById("gameCanvas");
const ctx = canvas.getContext("2d");
const minimapCanvas = document.getElementById("minimap");
const miniCtx = minimapCanvas.getContext("2d");
let width = canvas.width = window.innerWidth;
let height = canvas.height = window.innerHeight;
minimapCanvas.width = 150;
minimapCanvas.height = 150;
const WORLD_SIZE = 4000;
const colors = ['#f1c40f', '#e67e22', '#e74c3c', '#3498db', '#9b59b6', '#1abc9c', '#ff9ff3', '#00d2d3'];
const botNames = ['Alfa', 'Beta', 'Gama', 'Delta', 'Pika', 'Zeta', 'Titan', 'Ghost', 'Shadow', 'Ninja', 'Cyber', 'Neon'];
let camera = { x: WORLD_SIZE/2, y: WORLD_SIZE/2, zoom: 1 };
let manualZoom = 1; // Fare tekerleği zoomu için eklendi
let mouse = { x: width/2, y: height/2 };
let isSprinting = false; // Shift tuşu deparı için eklendi
let foods = [];
let viruses = [];
let ejectedMasses = [];
let bots = [];
let player = { id: 'player', name: 'Sen', color: '#2ecc71', cells: [] };
let isGameOver = false;
// Rastgele util
function rand(min, max) { return Math.random() * (max - min) + min; }
function getRandomColor() { return colors[Math.floor(Math.random() * colors.length)]; }
function getDist(x1, y1, x2, y2) { return Math.hypot(x2 - x1, y2 - y1); }
window.addEventListener('mousemove', (e) => { mouse.x = e.clientX; mouse.y = e.clientY; });
window.addEventListener('resize', () => { width = canvas.width = window.innerWidth; height = canvas.height = window.innerHeight; });
// Fare Tekerleği ile Zoom Mekaniği
window.addEventListener('wheel', (e) => {
manualZoom += e.deltaY * -0.001;
manualZoom = Math.min(Math.max(0.3, manualZoom), 2.5); // Zoom sınırları
});
// --- KLAVYE KONTROLLERİ VE HİLELER ---
window.addEventListener('keydown', (e) => {
if (isGameOver) return;
// Sprint (Depar)
if (e.key === 'Shift') isSprinting = true;
// Normal Yetenekler
if (e.code === 'Space') splitCells(player);
if (e.key.toLowerCase() === 'w') ejectMass(player);
// 👑 HİLE 1: Anında Büyüme
if (e.key === '1') {
player.cells.forEach(cell => cell.radius += 50);
}
// 👑 HİLE 2: Işınlanma
if (e.key === '2') {
let targetX = (mouse.x - width/2) / camera.zoom + camera.x;
let targetY = (mouse.y - height/2) / camera.zoom + camera.y;
player.cells.forEach(cell => {
cell.x = Math.max(cell.radius, Math.min(WORLD_SIZE - cell.radius, targetX));
cell.y = Math.max(cell.radius, Math.min(WORLD_SIZE - cell.radius, targetY));
});
}
// 👑 HİLE 3: Virüsleri Yut
if (e.key === '3') {
if (player.cells.length > 0 && viruses.length > 0) {
player.cells[0].radius += viruses.length * 4;
viruses = []; // Haritayı temizle
for(let i=0; i<25; i++) viruses.push({ x: rand(0, WORLD_SIZE), y: rand(0, WORLD_SIZE), radius: rand(45, 60) }); // Yenilerini spawnla
}
}
// 👑 HİLE 4: Botları Dondur ve Küçült
if (e.key === '4') {
bots.forEach(bot => {
bot.cells.forEach(cell => {
cell.radius = 12;
cell.vx = 0;
cell.vy = 0;
cell.targetX = cell.x; // Hedefi sıfırla ki durup kalsınlar
cell.targetY = cell.y;
});
});
}
});
window.addEventListener('keyup', (e) => {
if (e.key === 'Shift') isSprinting = false;
});
function init() {
isGameOver = false;
document.getElementById("gameOver").style.display = "none";
manualZoom = 1;
player.cells = [{ x: WORLD_SIZE/2, y: WORLD_SIZE/2, radius: 25, vx: 0, vy: 0 }];
foods = []; viruses = []; ejectedMasses = []; bots = [];
for(let i=0; i<1200; i++) foods.push({ x: rand(0, WORLD_SIZE), y: rand(0, WORLD_SIZE), radius: rand(4, 8), color: getRandomColor() });
for(let i=0; i<25; i++) viruses.push({ x: rand(0, WORLD_SIZE), y: rand(0, WORLD_SIZE), radius: rand(45, 60) });
for(let i=0; i<18; i++) spawnBot();
}
function spawnBot() {
bots.push({
id: 'bot_' + Math.random(),
name: botNames[Math.floor(Math.random() * botNames.length)],
color: getRandomColor(),
cells: [{ x: rand(0, WORLD_SIZE), y: rand(0, WORLD_SIZE), radius: rand(20, 70), vx: 0, vy: 0 }]
});
}
// --- BÖLÜNME (SPACE) MANTIĞI ---
function splitCells(entity) {
let newCells = [];
entity.cells.forEach(cell => {
if (cell.radius > 35 && entity.cells.length < 16) {
let halfArea = (Math.PI * cell.radius * cell.radius) / 2;
let newRadius = Math.sqrt(halfArea / Math.PI);
cell.radius = newRadius;
let angle;
if (entity === player) {
let targetX = (mouse.x - width/2) / camera.zoom + camera.x;
let targetY = (mouse.y - height/2) / camera.zoom + camera.y;
angle = Math.atan2(targetY - cell.y, targetX - cell.x);
} else {
// Botlar hedef yönüne bölünür
angle = Math.atan2((cell.targetY || 0) - cell.y, (cell.targetX || 0) - cell.x);
}
newCells.push({
x: cell.x, y: cell.y, radius: newRadius,
vx: Math.cos(angle) * 35, vy: Math.sin(angle) * 35
});
}
});
entity.cells = entity.cells.concat(newCells);
}
// --- YEM FIRLATMA (W) MANTIĞI ---
function ejectMass(entity) {
entity.cells.forEach(cell => {
if (cell.radius > 30) {
cell.radius -= 2.5;
let angle;
if(entity === player) {
let targetX = (mouse.x - width/2) / camera.zoom + camera.x;
let targetY = (mouse.y - height/2) / camera.zoom + camera.y;
angle = Math.atan2(targetY - cell.y, targetX - cell.x);
} else {
angle = Math.random() * Math.PI * 2; // Botlar etrafa rastgele yem atar
}
ejectedMasses.push({
x: cell.x + Math.cos(angle) * cell.radius,
y: cell.y + Math.sin(angle) * cell.radius,
radius: 12, color: entity.color,
vx: Math.cos(angle) * 18, vy: Math.sin(angle) * 18
});
}
});
}
// Virüs Patlama Mantığı
function popCell(entity, cellIndex) {
let cell = entity.cells[cellIndex];
let maxPieces = 10;
let piecesToCreate = Math.min(maxPieces, 16 - entity.cells.length);
if (piecesToCreate <= 0) return;
let areaPerPiece = (Math.PI * cell.radius * cell.radius) / (piecesToCreate + 1);
let newRadius = Math.sqrt(areaPerPiece / Math.PI);
cell.radius = newRadius;
for(let i=0; i<piecesToCreate; i++) {
let angle = Math.random() * Math.PI * 2;
entity.cells.push({
x: cell.x, y: cell.y, radius: newRadius,
vx: Math.cos(angle) * 25, vy: Math.sin(angle) * 25
});
}
}
function getTotalMass(entity) {
if(!entity || !entity.cells) return 0;
return entity.cells.reduce((sum, cell) => sum + (cell.radius * cell.radius), 0);
}
function update() {
if (isGameOver) return;
// Fırlatılan yem hareketi
ejectedMasses.forEach(e => {
e.x += e.vx; e.y += e.vy;
e.vx *= 0.9; e.vy *= 0.9;
e.x = Math.max(e.radius, Math.min(WORLD_SIZE - e.radius, e.x));
e.y = Math.max(e.radius, Math.min(WORLD_SIZE - e.radius, e.y));
});
let allEntities = [player, ...bots];
allEntities.forEach(entity => {
// Decay (Zamanla Kütle Kaybı)
entity.cells.forEach(cell => {
if (cell.radius > 40) cell.radius -= cell.radius * 0.0003;
});
entity.cells.forEach(cell => {
cell.x += cell.vx; cell.y += cell.vy;
cell.vx *= 0.85; cell.vy *= 0.85;
let speed = Math.max(1.5, 8 - Math.log(cell.radius));
if (entity === player) {
// Sprint (Depar) Özelliği - Sadece oyuncu için
if (isSprinting && cell.radius > 25) {
speed *= 1.6;
cell.radius -= 0.08; // Hızlı koşarken kütle kaybeder
}
let targetX = (mouse.x - width/2) / camera.zoom + camera.x;
let targetY = (mouse.y - height/2) / camera.zoom + camera.y;
let angle = Math.atan2(targetY - cell.y, targetX - cell.x);
if(getDist(targetX, targetY, cell.x, cell.y) > 10) {
cell.x += Math.cos(angle) * speed;
cell.y += Math.sin(angle) * speed;
}
} else {
// Gelişmiş Bot Hareketi ve Yapay Zeka Özellikleri
if(!cell.targetX || Math.random() < 0.01) {
cell.targetX = rand(0, WORLD_SIZE); cell.targetY = rand(0, WORLD_SIZE);
}
let angle = Math.atan2(cell.targetY - cell.y, cell.targetX - cell.x);
cell.x += Math.cos(angle) * speed;
cell.y += Math.sin(angle) * speed;
// Bot Yapay Zeka: Büyükse rastgele bölünebilir veya yem atabilir
if (cell.radius > 70 && Math.random() < 0.001) splitCells(entity);
if (cell.radius > 50 && Math.random() < 0.003) ejectMass(entity);
}
cell.x = Math.max(cell.radius, Math.min(WORLD_SIZE - cell.radius, cell.x));
cell.y = Math.max(cell.radius, Math.min(WORLD_SIZE - cell.radius, cell.y));
});
// Hücrelerin birbirini itmesi
for(let i=0; i<entity.cells.length; i++) {
for(let j=i+1; j<entity.cells.length; j++) {
let c1 = entity.cells[i], c2 = entity.cells[j];
let dist = getDist(c1.x, c1.y, c2.x, c2.y);
let minDist = c1.radius + c2.radius;
if(dist < minDist && dist > 0) {
let overlap = minDist - dist;
let dx = (c1.x - c2.x) / dist;
let dy = (c1.y - c2.y) / dist;
c1.x += dx * overlap * 0.1; c1.y += dy * overlap * 0.1;
c2.x -= dx * overlap * 0.1; c2.y -= dy * overlap * 0.1;
}
}
}
// Yem Yeme
entity.cells.forEach(cell => {
for (let i = foods.length - 1; i >= 0; i--) {
if (getDist(cell.x, cell.y, foods[i].x, foods[i].y) < cell.radius) {
cell.radius = Math.sqrt(cell.radius*cell.radius + foods[i].radius*foods[i].radius);
foods.splice(i, 1);
foods.push({ x: rand(0, WORLD_SIZE), y: rand(0, WORLD_SIZE), radius: rand(4, 8), color: getRandomColor() });
}
}
for (let i = ejectedMasses.length - 1; i >= 0; i--) {
if (getDist(cell.x, cell.y, ejectedMasses[i].x, ejectedMasses[i].y) < cell.radius && cell.radius > ejectedMasses[i].radius * 1.1) {
if(ejectedMasses[i].color === entity.color) continue; // Kendi attığını yiyemesin (Hızlı birleşmeyi engeller)
cell.radius = Math.sqrt(cell.radius*cell.radius + ejectedMasses[i].radius*ejectedMasses[i].radius);
ejectedMasses.splice(i, 1);
}
}
});
});
// Virüs Patlama Kontrolü
allEntities.forEach(entity => {
for (let c = entity.cells.length - 1; c >= 0; c--) {
for (let v = viruses.length - 1; v >= 0; v--) {
if (getDist(entity.cells[c].x, entity.cells[c].y, viruses[v].x, viruses[v].y) < entity.cells[c].radius) {
if (entity.cells[c].radius > viruses[v].radius * 1.15) {
entity.cells[c].radius = Math.sqrt(entity.cells[c].radius**2 + viruses[v].radius**2);
viruses.splice(v, 1);
viruses.push({ x: rand(0, WORLD_SIZE), y: rand(0, WORLD_SIZE), radius: rand(45, 60) });
popCell(entity, c);
}
}
}
}
});
// Varlıkların Birbirini Yemesi
let allCells = [];
allEntities.forEach(e => e.cells.forEach(c => allCells.push({ entity: e, cell: c })));
allCells.sort((a, b) => b.cell.radius - a.cell.radius);
for(let i=0; i<allCells.length; i++) {
let eater = allCells[i];
if(eater.cell.radius === 0) continue;
for(let j=i+1; j<allCells.length; j++) {
let prey = allCells[j];
if(prey.cell.radius === 0 || eater.entity === prey.entity) continue;
let dist = getDist(eater.cell.x, eater.cell.y, prey.cell.x, prey.cell.y);
if(dist < eater.cell.radius && eater.cell.radius > prey.cell.radius * 1.1) {
eater.cell.radius = Math.sqrt(eater.cell.radius**2 + prey.cell.radius**2);
prey.cell.radius = 0;
}
}
}
allEntities.forEach(e => {
e.cells = e.cells.filter(c => c.radius > 0);
});
bots = bots.filter(b => b.cells.length > 0);
while(bots.length < 18) spawnBot();
if (player.cells.length === 0) {
isGameOver = true;
document.getElementById("gameOver").style.display = "block";
} else {
// Kamera Zoom & Takip (Manuel Zoom ile birleştirildi)
let centerX = player.cells.reduce((sum, c) => sum + c.x, 0) / player.cells.length;
let centerY = player.cells.reduce((sum, c) => sum + c.y, 0) / player.cells.length;
let totalPlayerMass = Math.sqrt(getTotalMass(player));
camera.x += (centerX - camera.x) * 0.1;
camera.y += (centerY - camera.y) * 0.1;
// Oyuncu büyüdükçe kamera uzaklaşır, ancak fare tekerleğiyle bunu esnetebiliriz
let targetAutoZoom = Math.max(0.3, 1.5 - Math.log10(totalPlayerMass / 20));
let finalZoom = targetAutoZoom * manualZoom;
camera.zoom += (finalZoom - camera.zoom) * 0.1;
document.getElementById("score").innerText = Math.round(totalPlayerMass);
updateLeaderboard(allEntities);
drawMinimap(allEntities);
}
}
function updateLeaderboard(entities) {
let sorted = entities.map(e => ({ name: e.name, mass: getTotalMass(e), isPlayer: e === player }))
.sort((a, b) => b.mass - a.mass)
.slice(0, 10);
let html = "";
sorted.forEach((e, idx) => {
let cl = e.isPlayer ? "class='highlight'" : "";
html += `<li ${cl}>${e.name}</li>`;
});
document.getElementById("lb-list").innerHTML = html;
}
function drawMinimap(entities) {
miniCtx.clearRect(0, 0, 150, 150);
let scale = 150 / WORLD_SIZE;
miniCtx.fillStyle = 'rgba(46, 204, 113, 0.4)';
viruses.forEach(v => {
miniCtx.beginPath();
miniCtx.arc(v.x * scale, v.y * scale, 2, 0, Math.PI*2);
miniCtx.fill();
});
if(player.cells.length > 0) {
let px = player.cells[0].x * scale;
let py = player.cells[0].y * scale;
miniCtx.fillStyle = '#e74c3c';
miniCtx.beginPath();
miniCtx.arc(px, py, 5, 0, Math.PI*2);
miniCtx.fill();
}
}
function draw() {
ctx.fillStyle = "#111";
ctx.fillRect(0, 0, width, height);
ctx.save();
ctx.translate(width/2, height/2);
ctx.scale(camera.zoom, camera.zoom);
ctx.translate(-camera.x, -camera.y);
// Gelişmiş Arka Plan (Grid)
ctx.strokeStyle = 'rgba(255, 255, 255, 0.05)';
ctx.lineWidth = 2;
let step = 80;
ctx.beginPath();
for(let x=0; x<=WORLD_SIZE; x+=step) { ctx.moveTo(x, 0); ctx.lineTo(x, WORLD_SIZE); }
for(let y=0; y<=WORLD_SIZE; y+=step) { ctx.moveTo(0, y); ctx.lineTo(WORLD_SIZE, y); }
ctx.stroke();
// Sınırlar
ctx.strokeStyle = '#e74c3c'; ctx.lineWidth = 15;
ctx.strokeRect(0, 0, WORLD_SIZE, WORLD_SIZE);
// Yemler
foods.forEach(f => {
ctx.fillStyle = f.color;
ctx.beginPath(); ctx.arc(f.x, f.y, f.radius, 0, Math.PI*2); ctx.fill();
});
// Fırlatılan Yemler
ejectedMasses.forEach(e => {
ctx.fillStyle = e.color;
ctx.beginPath(); ctx.arc(e.x, e.y, e.radius, 0, Math.PI*2); ctx.fill();
ctx.lineWidth = 2; ctx.strokeStyle = "rgba(0,0,0,0.5)"; ctx.stroke();
});
// Virüsler
ctx.fillStyle = 'rgba(46, 204, 113, 0.8)';
ctx.strokeStyle = '#27ae60';
ctx.lineWidth = 5;
viruses.forEach(v => {
ctx.beginPath();
let spikes = 22;
for(let i=0; i<spikes*2; i++) {
let r = i % 2 === 0 ? v.radius : v.radius - 6;
let angle = (i / (spikes*2)) * Math.PI * 2;
ctx.lineTo(v.x + Math.cos(angle)*r, v.y + Math.sin(angle)*r);
}
ctx.closePath();
ctx.fill(); ctx.stroke();
});
// Oyuncu ve Botlar
let renderList = [];
[player, ...bots].forEach(e => e.cells.forEach(c => renderList.push({ entity: e, cell: c })));
renderList.sort((a, b) => a.cell.radius - b.cell.radius);
renderList.forEach(item => {
let {entity, cell} = item;
ctx.beginPath();
ctx.arc(cell.x, cell.y, cell.radius, 0, Math.PI*2);
ctx.fillStyle = entity.color;
if(entity === player) {
ctx.shadowBlur = 15;
ctx.shadowColor = entity.color;
}
ctx.fill();
ctx.shadowBlur = 0;
ctx.lineWidth = 4; ctx.strokeStyle = "rgba(0,0,0,0.4)"; ctx.stroke();
if (cell.radius > 20) {
ctx.fillStyle = 'white';
ctx.font = `bold ${Math.max(12, cell.radius/3.5)}px 'Segoe UI'`;
ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
// İsim
ctx.fillText(entity.name, cell.x, cell.y - (cell.radius * 0.15));
// Hücrenin kütlesini de hemen altına yazalım
ctx.font = `${Math.max(10, cell.radius/5)}px 'Segoe UI'`;
ctx.fillText(Math.round(cell.radius), cell.x, cell.y + (cell.radius * 0.25));
}
});
ctx.restore();
}
function gameLoop() {
update();
draw();
requestAnimationFrame(gameLoop);
}
function restartGame() { init(); }
init();
gameLoop();
</script>
</body>
</html>Biraz daha gelişmiş hali buyrun