马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
这个播放器非常小,只需花一点点时间下载,对于在体验网页上的多媒体效果是个很好的开始。
Flash制造物体弹跳电脑游戏,这是一种背景不动的一个物体能够弹跳,能够摆布走动的小游戏。对照基本的游戏。在文章的最初供应一切演示的Flash源文件。
看不到动画效果的伴侣请往这里寓目:http://bbs.jcwcn.com/thread-99274-1-1.html
启动Flash,起首修正文档属性。
起首制造两个影戏剪辑一个是背景,绘制一个矩形小块来当背景。到场AS为:stop(),让它入手下手就中断。
别的一个是活动的物体,给人人截图以下。
回到主场景,我们用Actionscript来完成别的效果。在主场景的第一帧间接到场上面代码:xspeed=0;
yspeed=0;
max_yspeed=16;
gravity=1;
walk_speed=4;
level=newArray();
_root.createEmptyMovieClip("lev",_root.getNextHighestDepth());
level[0]=newArray(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
level[1]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[2]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[3]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[4]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[5]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1);
level[6]=newArray(1,0,0,0,0,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1);
level[7]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[8]=newArray(1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[9]=newArray(1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[10]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[11]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,1);
level[12]=newArray(1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[13]=newArray(1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
level[14]=newArray(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
for(y=0;y<=14;y++){
for(x=0;x<=24;x++){
if(level[y][x]!=0){
place_brick=lev.attachMovie("block","block_"+lev.getNextHighestDepth(),lev.getNextHighestDepth(),{_x:x*20+10,_y:y*20+10});
place_brick.gotoAndStop(level[y][x]);
}
}
}
_root.attachMovie("player","player",_root.getNextHighestDepth(),{_x:40,_y:40});
player.onEnterFrame=function(){
yspeed+=gravity;
if(yspeed>max_yspeed){
yspeed=max_yspeed;
}
if(Key.isDown(Key.LEFT)){
xspeed=-walk_speed;
}
if(Key.isDown(Key.RIGHT)){
xspeed=walk_speed;
}
while(_root.lev.hitTest(this._x,this._y+this._height/2-1+yspeed,true)){
yspeed--;
}
while(_root.lev.hitTest(this._x-this._width/2+1+xspeed,this._y,true)){
xspeed++;
}
while(_root.lev.hitTest(this._x+this._width/2-1+xspeed,this._y,true)){
xspeed--;
}
this._y+=yspeed;
this._x+=xspeed;
xspeed=0;
};
</p>[1]200806/12956_2.html>[2]200806/12956_2.html>下一页
下面代码完成的效果是会呈现一幅不动的背景。效果以下。
[1][2]</b>
使用Flash创作的各个内容单元称为应用程序,即使它们可能只是很简单的动画。您也可以通过添加图片、声音、视频和特殊效果,构建包含丰富媒体的Flash应用程序。 |