🌳 MiniKıraft | ⭐ Puan: 0
// Ağaçlar const agaclar=[]; for(let i=0;i<15;i++){ agaclar.push({ x:Math.random()*850, y:Math.// Ağaçlar agaclar.forEach(a=>{ // Gövde ctx.fillStyle="#8B5A2B"; ctx.fillRect(a.x+8,a.y+18,12,22); // Yapraklar ctx.fillStyle="#228B22"; ctx.fillRect(a.x,a.y,28,24); });()*450const taslar=[]; for(let i=0;i<12;i++){ taslar.push({ x:Math.random()*850, y:Math.random()*450 }); }taslar.forEach(t=>{ ctx.fillStyle="#888"; ctx.fillRect(t.x,t.y,26,26); });const elmaslar=[]; // ===================== // CAN SİSTEMİ // ===================== let can = 10; function canCiz(){ ctx.fillStyle="red"; ctx.font="22px Arial"; ctx.fillText("❤️ Can: "+can,20,70); }// ===================== // SU GÖLÜ // ===================== const goller=[]; for(let i=0;i<4;i++){ goller.push({ x:Math.random()*850, y:Math.random()*420, w:80, h:60 }); } }); }// Ağaçlar agaclar.forEach(a=>{ // Gövde ctx.fillStyle="#8B5A2B"; ctx.fillRect(a.x+8,a.y+18,12,22); // Yapraklar ctx.fillStyle="#228B22"; ctx.fillRect(a.x,a.y,28,24); }); // Ağaçlar const agaclar=[]; for(let i=0;i<15;i++){ agaclar.push({ x:Math.random()*850, y:Math.random()*450 }); }// Ağaçlar agaclar.forEach(a=>{ // Gövde ctx.fillStyle="#8B5A2B"; ctx.fillRect(a.x+8,a.y+18,12,22); // Yapraklar ctx.fillStyle="#228B22"; ctx.fillRect(a.x,a.y,28,24); });// ===================== // GÖL ÇİZ // ===================== goller.forEach(g=>{ ctx.fillStyle="#3FA9F5"; ctx.fillRect(g.x,g.y,g.w,g.h); });// ===================== // ELMASLAR // ===================== const elmaslar=[]; for(let i=0;i<10;i++){ elmaslar.push({ x:Math.random()*850, y:Math.random()*450, alindi:false }); }// ===================== // ELMAS ÇİZ // ===================== elmaslar.forEach(e=>{ if(!e.alindi){ ctx.fillStyle="#00E5FF"; ctx.beginPath(); ctx.moveTo(e.x+10,e.y); ctx.lineTo(e.x+20,e.y+10); ctx.lineTo(e.x+10,e.y+20); ctx.lineTo(e.x,e.y+10); ctx.fill(); } });// ===================== // ELMAS ÇİZ // ===================== elmaslar.forEach(e=>{ if(!e.alindi){ ctx.fillStyle="#00E5FF"; ctx.beginPath(); ctx.moveTo(e.x+10,e.y); ctx.lineTo(e.x+20,e.y+10); ctx.lineTo(e.x+10,e.y+20); ctx.lineTo(e.x,e.y+10); ctx.fill(); } });// ===================== // ALTIN ÇİZ // ===================== altinlar.forEach(a=>{ if(!a.alindi){ ctx.fillStyle="gold"; ctx.fillRect(a.x,a.y,18,18); } });// ===================== // ENVANTER // ===================== let odun=0; let tas=0; let altin=0; let elmas=0;// ============================= // AYARLAR // ============================= let puan = 0; let karakterRengi = "#3498db"; let arkaPlanRengi = "#87CEEB"; let muzikAcik = true; let sesler = []; // ============================= // KAYDET // ============================= function kaydet(){ const veri={ puan, karakterRengi, arkaPlanRengi, muzikAcik }; localStorage.setItem( "MiniKiraftKayit", JSON.stringify(veri) ); alert("✔ Oyun Kaydedildi"); } // ============================= // YÜKLE // ============================= function yukle(){ const veri=JSON.parse( localStorage.getItem("MiniKiraftKayit") ); if(!veri) return; puan=veri.puan; karakterRengi=veri.karakterRengi; arkaPlanRengi=veri.arkaPlanRengi; muzikAcik=veri.muzikAcik; } // ============================= // MÜZİK // ============================= const ses=new(window.AudioContext|| window.webkitAudioContext)(); const nota=[ 392, 440, 494, 523, 494, 440, 392, 330 ]; let sira=0; function notaCal(f){ if(!muzikAcik)return; const osc=ses.createOscillator(); const gain=ses.createGain(); osc.type="square"; osc.frequency.value=f; gain.gain.value=0.03; osc.connect(gain); gain.connect(ses.destination); osc.start(); osc.stop(ses.currentTime+0.18); } setInterval(()=>{ notaCal(nota[sira]); sira++; if(sira>=nota.length){ sira=0; } },350); // ============================= // RENK MAĞAZASI // ============================= const renkler=[ {isim:"Kırmızı",renk:"#ff0000",puan:1}, {isim:"Sarı",renk:"#ffff00",puan:2}, {isim:"Yeşil",renk:"#00ff00",puan:3}, {isim:"Mavi",renk:"#0080ff",puan:4}, {isim:"Turuncu",renk:"#ff8000",puan:5}, {isim:"Koyu Mavi",renk:"#0033cc",puan:8}, {isim:"Koyu Yeşil",renk:"#006600",puan:9}, {isim:"Mor",renk:"#8000ff",puan:10}, {isim:"Lila",renk:"#c080ff",puan:15}, {isim:"Açık Pembe",renk:"#ffb6c1",puan:20}, {isim:"Siyah",renk:"#000000",puan:25}, {isim:"Beyaz",renk:"#ffffff",puan:25}, {isim:"Kahverengi",renk:"#8b4513",puan:13}, {isim:"Koyu Pembe",renk:"#ff1493",puan:40} ]; // ============================= // RENK SATIN AL // ============================= function renkSec(i){ if(puan{ const r = canvas.getBoundingClientRect(); const x = e.clientX - r.left; const y = e.clientY - r.top; if(x>15 && x<90 && y>40 && y<65){ menuAcik = !menuAcik; } }); // ====================================== // MENÜYÜ ÇİZ // ====================================== if(menuAcik){ ctx.fillStyle="rgba(255,255,255,0.95)"; ctx.fillRect(10,70,220,270); ctx.strokeStyle="black"; ctx.strokeRect(10,70,220,270); ctx.fillStyle="black"; ctx.font="18px Arial"; ctx.fillText("👕 Kıyafet Rengi",20,100); ctx.fillText("🎨 Arka Plan",20,130); ctx.fillText("🎵 Müzik Aç / Kapat",20,160); ctx.fillText("💾 Kaydet",20,190); ctx.fillText("📂 Yükle",20,220); ctx.fillText("⭐ Mağaza",20,250); }// ====================================== // ARKA PLAN RENGİNİ DEĞİŞTİR // ====================================== function arkaPlanDegistir(renk){ arkaPlanRengi = renk; }// ====================================== // KIYAFET RENGİNİ DEĞİŞTİR // ====================================== function kiyafetDegistir(renk){ karakterRengi = renk; }// ====================================== // SES AÇ / KAPAT // ====================================== function muzikDegistir(){ muzikAcik = !muzikAcik; }// ====================================== // OYUNU ÇİZ // ====================================== ctx.fillStyle="white"; ctx.font="20px Arial"; ctx.fillText("⭐ "+puan,760,30); ctx.fillText("🏠 Ev",20,30); ctx.fillStyle=karakterRengi; ctx.fillRect( oyuncu.x, oyuncu.y, 32, 32 );// ====================================== // BAŞLANGIÇ EKRANI // ====================================== ctx.fillStyle="rgba(0,0,0,0.45)"; ctx.fillRect(0,0,900,500); ctx.fillStyle="white"; ctx.font="40px Arial"; ctx.fillText("MiniKıraft",300,150); ctx.font="24px Arial"; ctx.fillText( "Başlamak için ENTER tuşuna bas", 210, 220 );// ====================================== // OYUN BİTTİ // ====================================== function oyunBitti(){ alert( "⭐ Toplam Puan : "+puan ); kaydet(); location.reload(); }// ====================================== // FPS GÖSTER // ====================================== ctx.fillStyle="white"; ctx.font="18px Arial"; ctx.fillText( "60 FPS", 800, 55 );// ====================================== // VERSİYON // ====================================== ctx.fillStyle="white"; ctx.font="14px Arial"; ctx.fillText( "MiniKıraft v1.0", 760, 490 );// ====================================== // ESC MENÜSÜ // ====================================== document.addEventListener("keydown",(e)=>{ if(e.key==="Escape"){ menuAcik=!menuAcik; } });// ====================================== // MAĞAZA MENÜSÜ // ====================================== let magazaAcik = false; function magazaAc(){ magazaAcik = !magazaAcik; } function magazayiCiz(){ if(!magazaAcik) return; ctx.fillStyle="rgba(255,255,255,0.95)"; ctx.fillRect(250,40,620,420); ctx.strokeStyle="black"; ctx.strokeRect(250,40,620,420); ctx.fillStyle="black"; ctx.font="24px Arial"; ctx.fillText("🎨 Renk Mağazası",430,75); }// ====================================== // RENK BUTONLARI // ====================================== const renkButonlari=[ ["Kırmızı","#ff0000",1], ["Sarı","#ffff00",2], ["Yeşil","#00ff00",3], ["Mavi","#0099ff",4], ["Turuncu","#ff8800",5], ["Koyu Mavi","#0033cc",8], ["Koyu Yeşil","#006600",9], ["Mor","#8000ff",10], ["Kahverengi","#8b4513",13], ["Lila","#c080ff",15], ["Açık Pembe","#ffb6c1",20], ["Siyah","#000000",25], ["Beyaz","#ffffff",25], ["Koyu Pembe","#ff1493",40] ];// ====================================== // MAĞAZAYI ÇİZ // ====================================== let xx=280; let yy=110; renkButonlari.forEach(r=>{ ctx.fillStyle=r[1]; ctx.fillRect(xx,yy,55,55); ctx.strokeStyle="black"; ctx.strokeRect(xx,yy,55,55); ctx.fillStyle="black"; ctx.font="14px Arial"; ctx.fillText(r[2]+" ⭐",xx,84+yy); xx+=80; if(xx>760){ xx=280; yy+=100; } });// ====================================== // SATIN AL // ====================================== function satinAl(id){ if(puan=arkaPlanlar.length){ seciliArkaPlan=0; } arkaPlanRengi=arkaPlanlar[seciliArkaPlan]; }// ====================================== // MÜZİK DÜĞMESİ // ====================================== ctx.fillStyle="white"; ctx.fillRect(760,15,120,35); ctx.strokeRect(760,15,120,35); ctx.fillStyle="black"; ctx.fillText("🎵 Müzik",775,38);// ====================================== // KAYDET DÜĞMESİ // ====================================== ctx.fillStyle="white"; ctx.fillRect(760,60,120,35); ctx.strokeRect(760,60,120,35); ctx.fillStyle="black"; ctx.fillText("💾 Kaydet",770,83);// ====================================== // YÜKLE DÜĞMESİ // ====================================== ctx.fillStyle="white"; ctx.fillRect(760,105,120,35); ctx.strokeRect(760,105,120,35); ctx.fillStyle="black"; ctx.fillText("📂 Yükle",775,128);// ====================================== // YÜKLE DÜĞMESİ // ====================================== ctx.fillStyle="white"; ctx.fillRect(760,105,120,35); ctx.strokeRect(760,105,120,35); ctx.fillStyle="black"; ctx.fillText("📂 Yükle",775,128);// ====================================== // PUAN GÖSTERGESİ // ====================================== ctx.fillStyle="gold"; ctx.font="24px Arial"; ctx.fillText( "⭐ "+puan, 20, 460 );// ====================================== // OYUN BAŞLIĞI // ====================================== ctx.fillStyle="white"; ctx.font="30px Arial"; ctx.fillText( "🟩 MiniKıraft", 330, 30 );// ====================================== // AYARLAR MENÜSÜ // ====================================== let ayarlarAcik = false; function ayarlarAc(){ ayarlarAcik = !ayarlarAcik; } function ayarlariCiz(){ if(!ayarlarAcik) return; ctx.fillStyle="rgba(255,255,255,0.95)"; ctx.fillRect(250,60,400,320); ctx.strokeStyle="black"; ctx.strokeRect(250,60,400,320); ctx.fillStyle="black"; ctx.font="28px Arial"; ctx.fillText("⚙️ Ayarlar",365,100); ctx.font="20px Arial"; ctx.fillText("🎨 Arka Plan Değiştir",280,150); ctx.fillText("👕 Kıyafet Rengi",280,190); ctx.fillText("🎵 Müzik Aç / Kapat",280,230); ctx.fillText("💾 Oyunu Kaydet",280,270); ctx.fillText("📂 Oyunu Yükle",280,310); }// ====================================== // BUTONLAR // ====================================== const butonlar=[ {x:270,y:130,w:260,h:30,tip:"arka"}, {x:270,y:170,w:260,h:30,tip:"kiyafet"}, {x:270,y:210,w:260,h:30,tip:"muzik"}, {x:270,y:250,w:260,h:30,tip:"kaydet"}, {x:270,y:290,w:260,h:30,tip:"yukle"} ];// ====================================== // FARE TIKLAMASI // ====================================== canvas.addEventListener("click",(e)=>{ const r=canvas.getBoundingClientRect(); const x=e.clientX-r.left; const y=e.clientY-r.top; butonlar.forEach(b=>{ if( x>b.x&& xb.y&& y{ puan++; },5000);// ====================================== // MENÜ AÇMA TUŞU // ====================================== document.addEventListener("keydown",(e)=>{ if(e.key==="m"||e.key==="M"){ ayarlarAc(); } });// ====================================== // ENVANTER SİSTEMİ // ====================================== let envanterAcik = false; const envanter = { puan: 0, kiyafet: "Mavi", arkaPlan: "Gökyüzü" }; function envanterAc(){ envanterAcik = !envanterAcik; } function envanteriCiz(){ if(!envanterAcik) return; ctx.fillStyle = "rgba(255,255,255,0.95)"; ctx.fillRect(220,40,460,320); ctx.strokeStyle = "black"; ctx.strokeRect(220,40,460,320); ctx.fillStyle = "black"; ctx.font = "28px Arial"; ctx.fillText("🎒 Envanter",360,80); ctx.font = "20px Arial"; ctx.fillText("⭐ Puan : "+puan,250,130); ctx.fillText("👕 Kıyafet : "+karakterRengi,250,170); ctx.fillText("🎨 Arka Plan : "+arkaPlanRengi,250,210); }// ====================================== // OYUNCUYU ÇİZ // ====================================== ctx.fillStyle = karakterRengi; ctx.fillRect( oyuncu.x, oyuncu.y, 32, 32 ); ctx.fillStyle = "white"; ctx.fillRect( oyuncu.x+8, oyuncu.y+8, 5, 5 ); ctx.fillRect( oyuncu.x+19, oyuncu.y+8, 5, 5 ); ctx.fillStyle = "black"; ctx.fillRect( oyuncu.x+10, oyuncu.y+10, 2, 2 ); ctx.fillRect( oyuncu.x+21, oyuncu.y+10, 2, 2 );// ====================================== // KARAKTER HAREKETİ // ====================================== if(tuslar["ArrowLeft"]||tuslar["a"]) oyuncu.x-=4; if(tuslar["ArrowRight"]||tuslar["d"]) oyuncu.x+=4; if(tuslar["ArrowUp"]||tuslar["w"]) oyuncu.y-=4; if(tuslar["ArrowDown"]||tuslar["s"]) oyuncu.y+=4; oyuncu.x=Math.max(0,Math.min(868,oyuncu.x)); oyuncu.y=Math.max(0,Math.min(468,oyuncu.y));// ====================================== // ENVANTER TUŞU // ====================================== document.addEventListener("keydown",(e)=>{ if(e.key==="e"||e.key==="E"){ envanterAc(); } });// ====================================== // BAŞLIK // ====================================== ctx.fillStyle="white"; ctx.font="30px Arial"; ctx.fillText("🟩 MiniKıraft",300,30); ctx.font="18px Arial"; ctx.fillText("E = Envanter",690,30); ctx.fillText("M = Menü",690,55);// ====================================== // BAŞLIK // ====================================== ctx.fillStyle="white"; ctx.font="30px Arial"; ctx.fillText("🟩 MiniKıraft",300,30); ctx.font="18px Arial"; ctx.fillText("E = Envanter",690,30); ctx.fillText("M = Menü",690,55);// ====================================== // PUAN GÖSTERGESİ // ====================================== ctx.fillStyle="gold"; ctx.font="22px Arial"; ctx.fillText("⭐ "+puan,20,35);// ====================================== // PUAN GÖSTERGESİ // ====================================== ctx.fillStyle="gold"; ctx.font="22px Arial"; ctx.fillText("⭐ "+puan,20,35);// ====================================== // OYUN SÜRÜMÜ // ====================================== ctx.fillStyle="white"; ctx.font="14px Arial"; ctx.fillText("MiniKıraft v1.1",760,490);// ====================================== // OYUN DÖNGÜSÜ SONU // ====================================== ayarlariCiz(); magazayiCiz(); envanteriCiz();