飞机大战-3
来源:互联网 发布:java thread getname 编辑:程序博客网 时间:2024/04/27 18:15
今天主要是敌方飞机的创建,下落;
前面已建飞机的父类call;
-
//创建飞机父类
> function commonPlane(hp,x,y,sizeX,sizeY,score,dietime,sudu,bombplane,srcImage){
> this.hp=hp;//血量
> this.planeX=x;
> this.planeY=y;
> this.planeSizex=sizeX;
> this.planeSizey=sizeY
> this.score=score;
> this.dietime=dietime;
> this.dietimes=0;//主要是飞机爆炸消失能看见过程,
> this.planeisdie=false;//在后面有做判断,子弹与敌方飞机的判断函数里planeisdie=true;
> this.bombplane=bombplane;//爆炸图片
> this.planeSrcImage=srcImage;
> this.sudu=sudu;//速度的变化用分数来决定;
> this.init=function(){
> this.oImg=document.createElement("img");
> this.oImg.style.left=this.planeX+"px";
> this.oImg.style.top=this.planeY+"px";
> this.oImg.src=srcImage;
> main.appendChild(this.oImg);
> }
> this.init();
> this.moveEnemy=function(){
> this.oImg.style.top=parseInt(this.oImg.style.top)+this.sudu+"px"
> }
> }
2、 敌方飞机: function enemyPlane(hp,x,y,sizeX,sizeY,score,dietime,sudu,bombplane,srcImage){
commonPlane.call(this,hp,random(x,y),-100,sizeX,sizeY,score,dietime,sudu,boomimage,imagesrc);
}
-
敌方的飞机类型分为大中小,要随机下落;//飞机的随机下落,大中小飞机出现频率的下落,自己试吧!
- 这里涉及到随机数的产生;
function random(min,max){
return Math.floor(min+Math.random()*(max-min));
}
- 这里涉及到随机数的产生;
下落到一定位置还是要删除(图片,数组);
main.removeChild(enemys[i].oImg);
enemys.splice(i,1);
0 0
- 飞机大战-3
- 飞机大战制作笔记3
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- 飞机大战
- Unity 3D飞机大战制作心得
- 飞机大战改进篇
- android飞机大战
- 飞机大战小游戏
- cocos2dx 3.0 飞机大战
- Cocos2d-x《雷电大战》(3)-子弹无限发射
- 线性规划 c 实现
- spring事务的两种配置方式
- 蓝桥杯C/C++编译选项的含义
- sublime Text 2使用sublimeREPL报错的解决方法
- 飞机大战-3
- 你悄然的走过我一切、走进我的内心,就像我悄然的走过你的一切;
- NSNotification、delegate和KVO的区别
- monkey monkeyrunner
- IOS学习之深浅拷贝
- VC 的 warning LNK4221 警告
- ACM-BestCoder Round #31
- SQL 统计分组 Group By和Compute By的整理
- Pretty Poem(substr)