毕业论文 论文提纲 论文写作 公文范例 教育论文 教育学论文 师范教育 学术论文     论文指导*
                     
 
   
   
   
   
           
 

当前位置:课件115学培吧(kj115.com)→FLASH课件游戏开发教程→文章系列

 
 
标题:由浅入深学习Flash制作赛车游戏教程
 
展示台

文章来源 作者:admin 密码:admin 整理:湖北金鹰

◇游戏开发栏目简介
内容是FLASH课件游戏制作教程,适合开发课件游戏,增加课件的感染力,适合高手学习,基础学习者可以参加我站的游戏开发视频教程的学习是最佳之选。

其它教程文章还有网侠教程图文教程等。
学习过程中如果需要相关的软件下载,你可以到本站软件下载专区去看看。

---------------

论文相关服务
 

湖北金鹰课件吧

赛车游戏我们总是遇到!今天给大家简单讲解一下。

首先新建立一个赛车影片剪辑,由6个图层组成一个基本的赛车。放到舞台上的时候命名实例名为car1。

由浅入深学习Flash制作赛车游戏教程

然后根据上面的车,制作一个赛车阴影影片剪辑。拖放到舞台上的时候命名实例名为shadow1。

由浅入深学习Flash制作赛车游戏教程

然后建立一个新的空的影片剪辑。拖放到舞台上的时候命名实例名stepper。

由浅入深学习Flash制作赛车游戏教程

然后选中该空影片剪辑输入下面代码:

onClipEvent(load){
speed1=0;
}
onClipEvent(enterFrame){
_root.step(1);
}

然后新建立一个层Action,输入下面代码:

functionstep(who){
//checktoseeifthecarinquestioniscontrolledbytheplayerorbythecomputer
if(_root["car"+who].code=="player"){
//wewillconstantlydecreasespeedbymultiplyingitwithanumberbelow1
if(this["speed"+who]>0.3){
this["speed"+who]*=_root.speedDecay;
}else{
this["speed"+who]=0;
}
//thecarwillreacttocertainkeys
//accelerate
if(Key.isDown(Key.UP)&&this["speed"+who]<_root.maxSpeed){
this["speed"+who]+=_root.acceleration;
}
//brake(reverse)
if(Key.isDown(Key.DOWN)){
this["speed"+who]-=_root.backSpeed;
}
//steerleft
if(Key.isDown(Key.LEFT)&&this["speed"+who]>0.3){
_root["car"+who]._rotation-=_root.rotationStep*(this["speed"+who]/_root.maxSpeed);
}
//steerright
if(Key.isDown(Key.RIGHT)&&this["speed"+who]>0.3){
_root["car"+who]._rotation+=_root.rotationStep*(this["speed"+who]/_root.maxSpeed);
}
this["rotation"+who]=_root["car"+who]._rotation;
//wecalculatethetwocomponentsofspeed(XaxisandYaxis)
this["speedx"+who]=Math.sin(this["rotation"+who]*(Math.PI/180))*this["speed"+who];
this["speedy"+who]=Math.cos(this["rotation"+who]*(Math.PI/180))*this["speed"+who]*-1;
//applythecomponentsontheactualpositionofthecar
_root["car"+who]._x+=this["speedx"+who];
_root["car"+who]._y+=this["speedy"+who];
//positiontheshadowofthecar
_root["shadow"+who]._x=_root["car"+who]._x-4;
_root["shadow"+who]._y=_root["car"+who]._y+2;
_root["shadow"+who]._rotation=_root["car"+who]._rotation;
}
if(_root["car"+who].code=="computer"){
}
}

然后再建立一个层,输入下面代码(用于初始化变量)

car1.code="player";
acceleration=0.4;
speedDecay=0.96;
rotationStep=10;
maxSpeed=10;
backSpeed=1;

测试了!今天快下班了!!明天接着给大家把这个游戏弄的更加完整!后面还有两个步骤,大家通过测试上面的动画会发现车没有场地限制!之后我们将给它限定一定的路线。期望!

 

 
课件115学培吧(湖北金鹰)欢迎您!永久免费服务网址:http://www.kj115.com
   
 

学员众多的FLASH课件学习基地,成万免费FLASH课件制作教程在线学习,还有免费内容课件教程、视频教程、课件技巧、课件探讨、课件欣赏、课件展示、实用教程、课件界面、课件脚本、课件游戏、课件下载、课件封面、课文内容图片、课文人物图片库、课件素材、图片素材、声音素材、动物素材、背景图片、背景资料、背景边框、课件顶栏图片素材、Dreamweaver教程、Dreamweaver网页课件教程、软件下载。承接学习和培训,承接课件订制,课件修改等所有课件相关服务。
本站主要业务:┃flash课件制作视频教程培训┃承接全国竞赛flash课件┃论文代写代发┃代办课件国家级获奖证书┃
联系:QQ:444860709 手机:13339817386


 
 

业务办理
鄂ICP备08005724号