HtmlKoD-MerkeZ.Tr.gg
Ana Sayfa
Iletisim
Ziyaretçi defteri
Sitene Haber Ekle
Sitene Döviz Ekle
Karisik Html Kodlari
Basit Kodlar
Sitene Icerik Kodlari
Araclar
Bedava-Sitem Sablonlari
Sitene Ekle
Oyun Ekle
=> Var mısın Yok musun Oyun Html Kodları
=> Yılan Oyun Kodları
Forum
Reklam Ve Sponsorluk
Site Haritasi
Yılan Oyun Kodları
Yılan Oyun Kodları
<script type="text/javascript"> <br /> <br /> <br /> fonksiyonu cbsnake () (<br /> <br /> / / Piksel kez <br de taşımak için /> this.jump = 8; <br /> / / Yılan Size. Az atlamak daha bu bir olun. Olmak zorunda değil iyi etkisi ekler <br /> this.sos = 7; <br /> / / Size of board <br /> / / TEHLİKE! this.sofb this.jump TEHLİKE tarafından eşit dividable !!!!< br /> olmalı this.sofb = 400; <br /> / / Set şeyler kadar <br /> this.daway = this.sofb - this.jump; <br /> this.correct = new Array (); <br /> this.correct [0] = 0; <br /> while ([this.correct.length -1 this.correct]! = this.daway) (<br /> [this.correct.length] = this.correct [this.correct.length this.correct -1] + this.jump <br /> ) <br /> this.zero = 0; <br /> var gameboard = '<div class="board" id="board"> <div id="i2"> Basit bir yılan oyunu oyuna başlamak için bir seviye seçin. </ div> </ div> <div class="board" id="score"> <span id="cscore"> 0 </ span> <span id="buttons"> <düğmesini type = "button" id = "yavaş" onClick = "snake.slow ()"> yavaş </ button> <button type="button" id="medium" onClick="snake.medium()"> orta </ button> <düğmesini type = "düğme" = "" onClick = "snake.fast ()"> hızlı </ button> </ strong> </ div> '; <br /> hızlı id (gameboard) document.write; <br /> ) <br /> <br /> cbsnake.prototype.setup = function () (<br /> setspeed var thisObj = Bu; <br /> / / Puan ... <br /> this.score = 0; <br /> / / Snake Direction <br /> this.sdir = 'none'; <br /> this.sdirb = 'none'; <br /> this.sdirp = 'none'; <br /> / / Snake arrays <br /> this.ctop = new Array (); <br /> this.cleft = new Array (); <br /> / / Yılan sınıf <br /> Top this.ctop [0] = 200; <br /> this.ctop [1] = -8; <br /> / / Yılan sınıf sol <br /> this.cleft [0] = 200; <br /> this.cleft [1] = -8; <br /> / elma <br / akım üst /> = 0 this.atop; <br /> / / elma <br sol akım /> this.aleft = 0; <br /> Hareket <br arasında / / milisaniye /> this.speed = setspeed; <br /> document.getElementById ( 'board'). innerHTML = '<div id="apple"> </ div> <div id="snake0" class="snake"> </ div> <div id = "snake1" class = "yılan"> </ div> '; <br /> this.moveapple (); <br /> this.stopgame = false; <br /> setTimeout (function () (thisObj.msnake ()), this.speed); <br /> document.onkeydown = function (e) (return thisObj.snakedir (e);); <br /> ) <br /> cbsnake.prototype.slow = function () (<br /> this.setup (100); <br /> this.buttons ( 'true'); <br /> document.getElementById ( 'slow') (); <br /> bulanıklık. ) <br /> cbsnake.prototype.medium = function () (<br /> this.setup (70); <br /> this.buttons ( 'true'); <br /> document.getElementById ( 'orta') (); <br /> bulanıklık. ) <br /> cbsnake.prototype.fast = function () (<br /> this.setup (30); <br /> this.buttons ( 'true'); <br /> document.getElementById ( 'hızlı') (); <br /> bulanıklık. ) <br /> cbsnake.prototype.rannum = function (NUM1, num2) (<br /> NUM1 = parseInt (NUM1); <br /> num2 = parseInt (num2); <br /> var generator = Math.random () * (Math.abs (num2-NUM1)); <br /> generator = Math.round (NUM1 + jeneratör); <br /> return jeneratör; <br /> ) <br /> cbsnake.prototype.moveapple = function () (<br /> var usethis = false; <br /> while (! usethis) (<br /> this.atop = this.correct [this.rannum (0, this.correct.length-1)]; <br /> this.aleft = this.correct [this.rannum (0, this.correct.length-1)]; <br /> if ((, this.atop, this.aleft) == 0) this.cleft this.ctop (this.numInArray <br /> usethis = true; <br /> ) <br /> ) <br /> ( 'elma') document.getElementById. style.top = this.atop + "px"; <br /> ( 'elma') document.getElementById. style.left = this.aleft + "px"; <br /> ) <br /> cbsnake.prototype.snakedir = function (e) (<br /> if (! e) (<br /> / / IE ... <br /> e = window.event; <br /> ) <br /> (e.keyCode) switch (<br /> case 38: <br /> if (this.sdir = 'down' & & this.sdirp = 'down') (<br /> this.sdirb = 'up'; <br /> this.sdirp = 'up'; <br /> ) <br /> break; <br /> case 40: <br /> if (this.sdir! = 'up' & & this.sdirp = 'up') (<br /> this.sdirb = 'down'; <br /> this.sdirp = 'down'; <br /> ) <br /> break; <br /> case 37: <br /> if (this.sdir! = '' & & this.sdirp right! = 'sağ') (<br /> this.sdirb = 'left; <br /> this.sdirp = 'left; <br /> ) <br /> break; <br /> case 39: <br /> if (this.sdir! = '' & & this.sdirp sol = 'left') (<br /> this.sdirb = 'sağ'; <br /> this.sdirp = 'sağ'; <br /> ) <br /> break; <br /> case 32: <br /> if (this.sdir == 'none' & & this.sdirp = 'none') (<br /> this.sdirb = this.sdirp; <br /> this.sdirp = 'none'; <br /> ) <br /> else (<br /> this.sdirp = this.sdir; <br /> this.sdirb = 'none'; <br /> ) <br /> break; <br /> ) <br /> return this.stopgame; <br /> <br /> ) <br /> cbsnake.prototype.msnake = function () (<br /> if (false === this.stopgame) (<br /> if (this.sdir = 'none') (<br /> this.moveall (); <br /> ) <br /> var thisObj = Bu; <br /> (this.sdir) switch (<br /> case 'up': <br /> this.ctop [0] = this.ctop [0] - this.jump; <br /> document.getElementById ( 'snake0'). style.top = this.ctop [0] + "px"; <br /> if ((this.ctop [0] == this.zero & & this.sdirb == 'up') | | this.ctop [0] <this.zero) (<br /> this.gover (); <br /> ) <br /> break; <br /> case 'down': <br /> this.ctop [0] = this.ctop [0] + this.jump; <br /> document.getElementById ( 'snake0'). style.top = this.ctop [0] + "px"; <br /> if ((this.ctop [0] == this.daway & & this.sdirb == 'down') | | this.ctop [0]> this.daway) (<br /> this.gover (); <br /> ) <br /> break; <br /> case 'left: <br /> this.cleft [0] = this.cleft [0] - this.jump; <br /> document.getElementById ( 'snake0'). style.left = this.cleft [0] + "px"; <br /> if ((this.cleft [0] == this.zero & & this.sdirb == 'left') | | this.cleft [0] <this.zero) (<br /> this.gover (); <br /> ) <br /> break; <br /> case 'doğru': <br /> this.cleft [0] = this.cleft [0] + this.jump; <br /> document.getElementById ( 'snake0'). style.left = this.cleft [0] + "px"; <br /> if ((this.cleft [0] == this.daway & & == 'right') | | this.cleft [0]> this.daway) (this.sdirb <br /> this.gover (); <br /> ) <br /> break; <br /> ) <br /> if (this.sdir = 'none') (<br /> this.hitself (); <br /> this.happle (); <br /> ) <br /> this.sdir = this.sdirb <br /> setTimeout (function () (thisObj.msnake ()), this.speed); <br /> ) <br /> ) <br /> cbsnake.prototype.gover = function () (<br /> if (!) this.stopgame (<br /> this.stopgame = true; <br /> iç =) ( 'board' document.getElementById. innerHTML; <br /> document.getElementById ( 'board'). = iç innerHTML + '<div id="notice"> oyun bitti senin puanın' + this.score + '</ div> <div id="i2"> Yılan oyununu <a href = " http://htmlkod.tr.gg "> sitene ekle </ a> </ div> '; <br /> ( 'elma') document.getElementById. style.backgroundColor = '# D7BEBE'; <br /> (i = 0; i <this.cleft.length; i ++){< br /> için document.getElementById ( 'snake' + i). style.backgroundColor = '# BEBEBE'; <br /> ) <br /> this.buttons ('');< br /> ) <br /> ) <br /> cbsnake.prototype.happle = function () (<br /> if (this.atop == this.ctop [0] & & this.aleft == this.cleft [0]) (<br /> / / HIT! <br /> this.score + +; <br /> ( 'cscore') document.getElementById. innerHTML = this.score; <br /> this.moveapple (); <br /> this.addsnake (); <br /> ) <br /> ) <br /> cbsnake.prototype.addsnake = function () (<br /> var newsnake = document.createElement ( 'div'); <br /> var NEWID = 'yılan' + this.cleft.length; <br /> newsnake.setAttribute ( 'id', NEWID); <br /> / / bu bok IE için. Ben daha çok sınıf adı eklersiniz. <br /> newsnake.style.position = 'absolute'; <br /> newsnake.style.top = '-10px'; <br /> newsnake.style.left = '-10px'; <br /> newsnake.style.display = 'none'; <br /> newsnake.style.backgroundColor = 'black'; <br /> newsnake.style.height = '7 px '; <br /> newsnake.style.width = '7 px '; <br /> newsnake.style.overflow = 'hidden'; <br /> document.getElementById ( 'board'). appendChild (newsnake); <br /> this.cleft [this.cleft.length] = -10; <br /> this.ctop [this.ctop.length] = -10; <br /> ) <br /> cbsnake.prototype.moveall = function () (<br /> var i = - 1; <br /> this.ctop.length while (i = 0) (<br /> document.getElementById ( 'snake' + i). style.top = ( 'yılan' document.getElementById + (i-1)). style.top; <br /> document.getElementById ( 'snake' + i). style.left = ( 'yılan' document.getElementById + (i-1)). style.left; <br /> document.getElementById ( 'snake' + i). style.display = 'block'; <br /> this.ctop [i] = this.ctop [i-1]; <br /> this.cleft [i] = this.cleft [i-1]; <br /> i = i - 1; <br /> ) <br /> ) <br /> cbsnake.prototype.numInArray = function (dizi, dizi2, değer, değer2) (<br /> var n = 0; <br /> for (var i = 0; i <array.length; i + +) (<br /> (dizi [i] === value & & dizi2 [i] === value2) (if <br /> n + +; <br /> ) <br /> ) <br /> return n; <br /> ) <br /> cbsnake.prototype.hitself = function () (<br /> if ((, this.ctop [0], this.cleft this.cleft [0 this.ctop])> 1) (this.numInArray <br /> this.gover (); <br /> ) <br /> ) <br /> cbsnake.prototype.buttons = function (setto) (<br /> document.getElementById ( 'slow' = setto devre dışı.); <br /> document.getElementById ( 'orta' = setto devre dışı.); <br /> document.getElementById ( 'hızlı' = setto devre dışı.); <br /> ) <br /> </ script> <style type="text/css">. board (width: 399px; background-color: lightgrey; border: 1px solid gray; position: relative; margin-left: 0; margin-top: 0;) # board (height: 399px; border-bottom: 0px;) # elma (position: absolute; background-color: red; height: 7px; width: 7px; overflow: hidden;). snake (position: absolute; top: 200px ; left: 200px; background-color: black; height: 7px; width: 7px; overflow: hidden;). snake2 (position: absolute; top: 10px; left:-10px; background-color: black; height: 7px width: 7px; overflow: hidden;) # puanı (height: 50px; margin-top: 0px;) # cscore (color: black; padding-left: 10px; float: left; width: 25%; font-size: xx-large;) # buttons (float: right; width: 50%; text-align: right; padding-top: 10px;) # duyuru (position: absolute; top: 1em; left: 1em; right: 1em; metin -align: center; font-size: 150%;) # i2 (position: absolute; bottom: 1em; left: 1em; right: 1em; text-align: center; font-size: 95%;) </ style> <script type="text/javascript"> <br /> yılan var = yeni cbsnake (); <br /> </ script>