Sign up
Login
New
Trending
Archive
English
English
Sign up
Login
New Paste
Add Image
<!DOCTYPE html> <html lang="tr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <title>Nazlının Snake Oyunu</title> <style> body { margin: 0; overflow: hidden; background-color: #fff0f5; font-family: 'Courier New', Courier, monospace; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100vh; touch-action: none; } #gameHeader { display: flex; align-items: center; gap: 15px; margin-bottom: 10px; } .decorative-heart-outer { font-size: 35px; color: #ff0000; animation: beat 0.8s infinite alternate; } @keyframes beat { to { transform: scale(1.2); } } #gameContainer { position: relative; border: 8px solid #000000; border-radius: 8px; background: #ffffff; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); overflow: hidden; } canvas { display: block; } #ui { text-align: center; margin-bottom: 10px; color: #ff1493; font-size: 20px; font-weight: bold; display: flex; gap: 20px; } .screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255, 255, 255, 0.95); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 20; text-align: center; } .hidden { display: none !important; } button { background: #000000; border: none; padding: 12px 25px; color: white; font-weight: bold; font-size: 18px; border-radius: 5px; cursor: pointer; margin-top: 15px; } #controls { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 65px); gap: 10px; } .btn-ctrl { width: 65px; height: 65px; background: #333; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 24px; color: white; user-select: none; } .btn-ctrl:active { background: #000; transform: scale(0.95); } </style> </head> <body> <div id="gameHeader"> <h2 style="color: #000; margin: 0;">NAZLI'NIN OYUNU</h2> <div class="decorative-heart-outer">❤️</div> </div> <div id="ui"> <div>SKOR: <span id="scoreVal">0</span></div> <div>REKOR: <span id="highScoreVal">0</span></div> </div> <div id="gameContainer"> <canvas id="snakeCanvas"></canvas> <div id="startScreen" class="screen"> <p style="color: #666; font-weight: bold;">Hüseyin'leri topla!</p> <p style="font-size: 12px; color: #ff1493;">Ölümsüzlük Modu Aktif</p> <button onclick="startGame()">BAŞLAT</button> </div> <div id="gameOverScreen" class="screen hidden"> <h2 style="color: #000;">OYUN BİTTİ</h2> <p>Skor: <span id="finalScore">0</span></p> <button onclick="startGame()">TEKRAR DENE</button> </div> </div> <div id="controls"> <div></div><div class="btn-ctrl" onmousedown="changeDir('up')" ontouchstart="changeDir('up')">↑</div><div></div> <div class="btn-ctrl" onmousedown="changeDir('left')" ontouchstart="changeDir('left')">←</div><div class="btn-ctrl" onmousedown="changeDir('down')" ontouchstart="changeDir('down')">↓</div><div class="btn-ctrl" onmousedown="changeDir('right')" ontouchstart="changeDir('right')">→</div> </div> <script> const canvas = document.getElementById('snakeCanvas'); const ctx = canvas.getContext('2d'); const scoreEl = document.getElementById('scoreVal'); const highScoreEl = document.getElementById('highScoreVal'); const finalScoreEl = document.getElementById('finalScore'); const startScreen = document.getElementById('startScreen'); const gameOverScreen = document.getElementById('gameOverScreen'); // Grid boyutu küçültüldü (yılan daha küçük görünecek) const gridSize = 30; let tileCountX, tileCountY; let snake = []; let food = { x: 5, y: 5 }; let dx = 1; let dy = 0; let score = 0; let highScore = 0; let gameTimeout; let speed = 120; function init() { // Oyun alanı büyütüldü (ekranın %95'i kadar genişlik) const w = Math.min(window.innerWidth - 30, 600); const h = Math.min(window.innerHeight - 300, 500); canvas.width = Math.floor(w / gridSize) * gridSize; canvas.height = Math.floor(h / gridSize) * gridSize; tileCountX = canvas.width / gridSize; tileCountY = canvas.height / gridSize; } window.addEventListener('resize', init); init(); function startGame() { snake = [{ x: 4, y: 4 }, { x: 3, y: 4 }, { x: 2, y: 4 }]; generateFood(); dx = 1; dy = 0; score = 0; speed = 120; scoreEl.innerText = score; startScreen.classList.add('hidden'); gameOverScreen.classList.add('hidden'); if (gameTimeout) clearTimeout(gameTimeout); gameLoop(); } function generateFood() { food = { x: Math.floor(Math.random() * tileCountX), y: Math.floor(Math.random() * tileCountY) }; if (snake.some(p => p.x === food.x && p.y === food.y)) generateFood(); } function changeDir(dir) { if (dir === 'up' && dy === 0) { dx = 0; dy = -1; } if (dir === 'down' && dy === 0) { dx = 0; dy = 1; } if (dir === 'left' && dx === 0) { dx = -1; dy = 0; } if (dir === 'right' && dx === 0) { dx = 1; dy = 0; } } window.addEventListener('keydown', e => { if (e.key === 'ArrowUp') changeDir('up'); if (e.key === 'ArrowDown') changeDir('down'); if (e.key === 'ArrowLeft') changeDir('left'); if (e.key === 'ArrowRight') changeDir('right'); }); function gameLoop() { let headX = snake[0].x + dx; let headY = snake[0].y + dy; // Ölümsüzlük: Duvarlardan geçiş if (headX < 0) headX = tileCountX - 1; if (headX >= tileCountX) headX = 0; if (headY < 0) headY = tileCountY - 1; if (headY >= tileCountY) headY = 0; // Kendine çarpma durumunda yanma iptal edildi, sadece içinden geçer const head = { x: headX, y: headY }; snake.unshift(head); if (head.x === food.x && head.y === food.y) { score += 10; scoreEl.innerText = score; if(score > highScore) { highScore = score; highScoreEl.innerText = highScore; } speed = Math.max(70, speed - 1); generateFood(); } else { snake.pop(); } draw(); gameTimeout = setTimeout(gameLoop, speed); } function draw() { ctx.fillStyle = "#ffffff"; ctx.fillRect(0, 0, canvas.width, canvas.height); ctx.strokeStyle = "#f8f8f8"; ctx.lineWidth = 1; for(let i = 0; i <= tileCountX; i++) { ctx.beginPath(); ctx.moveTo(i * gridSize, 0); ctx.lineTo(i * gridSize, canvas.height); ctx.stroke(); } for(let i = 0; i <= tileCountY; i++) { ctx.beginPath(); ctx.moveTo(0, i * gridSize); ctx.lineTo(canvas.width, i * gridSize); ctx.stroke(); } const fx = food.x * gridSize; const fy = food.y * gridSize; ctx.save(); ctx.fillStyle = "#000000"; ctx.font = "bold 11px sans-serif"; ctx.textAlign = "center"; ctx.textBaseline = "middle"; ctx.fillText("HÜSEYİN", fx + gridSize/2, fy + gridSize/2); ctx.restore(); snake.forEach((p, i) => { const isHead = i === 0; const sx = p.x * gridSize; const sy = p.y * gridSize; ctx.fillStyle = isHead ? "#ff1493" : "#ff69b4"; ctx.beginPath(); ctx.roundRect(sx + 1, sy + 1, gridSize - 2, gridSize - 2, 8); ctx.fill(); if (isHead) { // Gözler ctx.fillStyle = "white"; ctx.beginPath(); ctx.arc(sx + gridSize*0.3, sy + gridSize*0.3, gridSize*0.12, 0, Math.PI * 2); ctx.arc(sx + gridSize*0.7, sy + gridSize*0.3, gridSize*0.12, 0, Math.PI * 2); ctx.fill(); ctx.fillStyle = "black"; ctx.beginPath(); ctx.arc(sx + gridSize*0.3, sy + gridSize*0.3, gridSize*0.06, 0, Math.PI * 2); ctx.arc(sx + gridSize*0.7, sy + gridSize*0.3, gridSize*0.06, 0, Math.PI * 2); ctx.fill(); } }); } function gameOver() { // Şu an ölümsüzlük aktif olduğu için çağrılmaz clearTimeout(gameTimeout); finalScoreEl.innerText = score; gameOverScreen.classList.remove('hidden'); } </script> </body> </html>
Settings
Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English