编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

堆木头小游戏(堆木块的游戏怎么堆最高)

wxchong 2024-07-29 07:54:37 开源技术 11 ℃ 0 评论

欢迎来到程序小院

堆木头小游戏

玩法:
当木头移动到木头堆正上方时,按下按钮放木头,尽可能的对齐木头^^

开始游戏

html

  <div class="baidu_share">
    <!-- Baidu Button BEGIN -->
    <div id="bdshare" class="bdshare_t bds_tools_32 get-codes-bdshare" style="margin-left:20px;">
        <a class="bds_tsina"></a>
        <a class="bds_qzone"></a>
        <a class="bds_tqq"></a>
        <a class="bds_douban"></a>
        <a class="bds_renren"></a>
        <a class="shareCount"></a>
    </div>
    <!-- Baidu Button END -->
    <br style="clear: both">
  </div>

css

.ibox {width:320px; height:315px; overflow:hidden; background-color: #000000; margin:auto;}
.iboxcontent {width:320px; height:315px; float:left; overflow:hidden;}
.ibc1 {background-color: #3b4859; background-image:url(/default/game/dmt/bg1.png);}
.ibc2 {background-color: #404d5e; background-image:url(/default/game/dmt/bg2.png);}

#alertbox {display:none;position:absolute; z-index:200;}
#alertbox_flekk {position:absolute; width:320px; height: 316px; background-color:#000000; opacity: .8;}
#alertbox_content {position:absolute; width:320px; height:286px; margin-top:70px; text-align:center; color:#ffffff;}
#alertbox_content .fontostext {color:#a3b3c3;}
#alertbox a {margin:10px; width:114px; height:54px; }

js

  function showaronk(srid,srtype,srstart,srsize) {
 srt='/default/game/dmt/'+srtype
 tmp=document.createElement('div');
 tmp.style.position='absolute';
 tmp.style.width=extraleft[srtype]+srsize+extraright/2+'px';
 tmp.style.height=logh+'px';
 tmp.style.zIndex=15;

 tmp2=document.createElement('div');
 tmp2.style.position='absolute';
 tmp2.style.width=srsize+'px';
 tmp2.style.height=logh+'px';
 tmp2.style.marginLeft=extraleft[srtype]+'px';
 tmp2.style.backgroundImage='url('+srt+'2.png)';
 tmp2.style.backgroundPosition=srstart+'px 0';
 tmp.appendChild(tmp2);

 tmp2=document.createElement('img');
 tmp2.src=srt+'3.png';
 tmp2.style.marginLeft=extraleft[srtype]+srsize-extraright/2;
 tmp2.style.position='absolute';
 tmp.appendChild(tmp2);

 tmp2=document.createElement('img');
 tmp2.src=srt+'1.png';
 tmp2.style.position='absolute';
 tmp.appendChild(tmp2);

 getId(srid).appendChild(tmp);
}

function gameover() {
 gameisover=1;
 gamesplayed++;
 setCookie('stack_gamesplayed',gamesplayed);
 document.getElementById('gamesplayed').innerHTML=gamesplayed;
 if(stscore>theirbest) {
  setCookie('stack_bestscore',stscore);
  document.getElementById('yourbest').innerHTML=stscore;
  theirbest=stscore;
  ialert('<h1>游戏结束: '+stscore+'分</h1>厉害,你又破纪录了','restartgame();');
 } else {
  ialert('<h1>游戏结束: '+stscore+'</h1>再来一次?','restartgame();');
 }
 //urchinTracker('/stack/gamesplayed/');
 return false;
}

function restartgame() {
 clearInterval(stinterval);
 gameisover=0;
 stwidth=new Array();
 stmargin=new Array();
 sttype=new Array();
 ststart=new Array();
 stscore=0;
 sts=0;
 stwidth[0]=260; //a ronk maga!
 ststart[0]=(stwidth[0]-270)*Math.random();
 stmargin[0]=(saw-stwidth[0])/2; //ronk margoja!
 sttype[0]=Math.floor(Math.random()*4)+1;
 paddingtarget=0,paddingnow=0;
 dnd=0;
 getId('combo').innerHTML=0;
 getId('level').innerHTML=1;
 getId('score').innerHTML=stscore;
 getId('score').styleColor='red';
 getId('st_outerarea').innerHTML='';
 init();
}
function getCookie(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) {
   offset = document.cookie.indexOf(search)
   if (offset != -1) {
    offset += search.length
    end = document.cookie.indexOf(";", offset)
    if (end == -1)
     end = document.cookie.length;
    return unescape(document.cookie.substring(offset, end))
   }
  }
  return('');
 }

 function setCookie(name, value) {
  document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : 
  ("; expires=" + expire.toGMTString())+';domain=lapp.xinli001.com;path=/;');
 }

function setTI(todos,interval) {
 if(stispace[todos].length == 0) {delete stispace[todos];return false;}
 eval(stispace[todos].shift());
 setTimeout('setTI('+todos+','+interval+')',interval);
}

源码

需要源码请关注添加好友哦^ ^

转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表