1 Star 0 Fork 0

rick_鼠标手 / 打飞机

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Main.js 1.93 KB
一键复制 编辑 原始数据 按行查看 历史
Dengwc 提交于 2018-03-03 16:01 . 打飞机小game
var Main;
(function(){
var rect; //敌人;
var text; //文本
var star; //星星;
var score=10; //分
var hitNum=0; //击中的个数
Main = function(){
Main.prototype.init();
}
Main.prototype.init=function()
{
OBODY.style.background="url("+BG+") no-repeat center top";
OBODY.style.overflow="hidden";
OBODY.style.height=CLIENTHEIGHT+"px";
text = new Text();
text.init();
rect = new oTuZi();
rect.init();
star = new Star(50);
star.init();
//添加经过事件;
Main.prototype.addOverEvent();
//计时
Main.prototype.getTimeJs();
//页面发生改变;
Main.prototype.scrollSize();
//背景抖动;
Main.prototype.bgMove();
}
Main.prototype.bgMove=function()
{
var x,y;
setInterval(function(){
x=0.6*Math.random()+0.7
y=0.6*Math.random()+0.4
OBODY.style.backgroundPosition =x+"% "+y+"%";
},500)
}
Main.prototype.scrollSize=function()
{
CLIENTHEIGHT = document.body.clientHeight || document.documentElement.clientHeight; //页面高度;
CLIENTWIDTH = document.body.clientWidth || document.documentElement.clientWidth; //页面宽度
var divElements,i;
window.onresize=function(){;
divElements = document.getElementsByTagName("div");
for(i=0;i<CLEARBARR.length;i++)
{
//clearTimeout(CLEARBARR[i])
}
}
}
Main.prototype.getTimeJs=function()
{
var jsDate=0.01;
var hours='';
var hoursIndex=0;
JSOBJ = document.getElementById(JS);
setInterval(function(){
jsDate+=0.01;
JSOBJ.value=hours+jsDate.toFixed(2)+"";
},9)
}
Main.prototype.addOverEvent=function()
{
HITOBJ = document.getElementById(JZ);
SCOREOBJ = document.getElementById(DF);
document.addEventListener("click",onOver,false);
function onOver()
{
if(event.target.parentNode.getAttribute("numIndex"))
{
hitNum++
HITOBJ.value=""+hitNum;
SCOREOBJ.value =""+ hitNum*score
oTuZi.prototype.clearEventElement(event.target.parentNode);
}
}
}
})();
1
https://gitee.com/dengwc/hit_a_plane.git
git@gitee.com:dengwc/hit_a_plane.git
dengwc
hit_a_plane
打飞机
master

搜索帮助