js实现桌球游戏效果代码

代码语言:html

所属分类:游戏

代码描述:js实现桌球游戏效果代码,按住左键,移动鼠标进行瞄准,左键不放选择力度,然后松开左键。

代码标签: 游戏 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        * {margin:0; padding:0}
    body {background:black; text-align:center}
    h1 {font-size:12px; color:gray; font-weight:normal; line-height:200%}
    h1 .sub {vertical-align:super; color:red; font-size:9px; }
    .info {position:absolute; right:0}
    #table {position:relative; width:800px; margin:20px auto 10px; height:544px; background:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/table.jpg) no-repeat}
    .ball {position:absolute; width:30px; height:30px}
    #dotWrap {position:absolute; z-index:2; left:32px; top:32px; width:736px; height:480px}
    .guide {z-index:3; background-image:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/dashed_ball.png); _background:none; _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src="//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/dashed_ball.png"); background-repeat:no-repeat}
    .target {left:500px; top:250px; background-image:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/yellow_ball.png); _background:none; _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src="//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/yellow_ball.png"); background-repeat:no-repeat}
    .cue {background-image:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/white_ball.png); _background:none; _filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='scale', src="//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/white_ball.png"); background-repeat:no-repeat}
    .bot {position:relative; width:800px; margin:10px auto 10px; height:70px}
    .ctrl {position:absolute; top:0; right:0; width:200px; height:80px; background:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/bg_controler.png) no-repeat}
    #force {position:absolute; left:0; top:18px; width:75px; height:20px; background:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/force_conver.png) no-repeat}
    #shootPos {position:absolute; top:0; right:14px; width:52px; height:52px}
    #dot {position:absolute; top:22px; left:22px; width:8px; height:8px; background:url(//repo.bfw.wiki/bfwrepo/images/game/zuoqiu/bule_dot.png) no-repeat; font-size:1px}
    #scoreBoard {position:absolute; z-index:3; top:230px; left:346px; font-size:50px; color:white; filter:alpha(opacity=0); -moz-opacity:0; opacity:0}
    #tips {padding:15px 0 0 20px; text-align:left; color:red; font-size:12px}
    </style>
    <script type="text/javascript">
        // common 
    function $(str) {
    	return document.getElementById(str);
    }
    
    function $tag(str,target) {
    	target = target || document;
    	return target.getElementsByTagName(str);
    }
    
    function addEventHandler(obj,eType,fuc){
    	if(obj.addEventListener){ 
    		obj.addEventListener(eType,fuc,false); 
    	}else if(obj.attachEvent){ 
    		obj.attachEvent("on" + eType,fuc); 
    	}else{ 
    		obj["on" + eType] = fuc; 
    	} 
    } 
    
    function removeEventHandler(obj,eType,fuc){
    	if(obj.removeEventListener){ 
    		obj.removeEventListener(eType,fuc,false); 
    	}else if(obj.attachEvent){ 
    		obj.detachEvent("on" + eType,fuc); .........完整代码请登录后点击上方下载按钮下载查看

网友评论0