| 首页 | 新闻 | 网页 | 设计 | 色彩 | 原创 | 视觉 | 素材 | 动漫 | 酷站 | 策划 | 文案 | 访谈 | 运营 | 编程 | 数据库 | 服务器 | 下载 | 图库 | 
您的位置: 幽幽天空 > 网页 > 网页制作 > Flash教程 > Flash游戏制作 > 文章正文 用户登录
没有相关文章

大炮打敌机小游戏(附源码)           

大炮打敌机小游戏(附源码)

作者:佚名 来源:闪吧 作者: zhydlzr 更新:2007-1-13 20:43:04 错误报告 我要投稿
点击浏览该文件
点击浏览该文件

主场景中ball的帧内容:

主场景中AS:
gun_mc._rotation=-40;
_root.ang=-40;
_root.total=0;
_root.attachMovie("fly","fly",10,{_x:random(300)+220,_y:random(220)+10});
up_btn.onPress=function(){
turnangle(5);
if(gun_mc._rotation<-85){
gun_mc._rotation=-85;
}
}
down_btn.onPress=function(){
turnangle(-5);
if(gun_mc._rotation>-5){
gun_mc._rotation=-5;
}
}
function turnangle(tmp){
gun_mc._rotation+=-1*tmp;
_root.ang=gun_mc._rotation;
}
fire_btn.onPress=function(){
if(_root.ball._currentframe==1){
_root.ball.gotoAndPlay(2);
}
}


//------------------------------------

ball中第一帧:
stop ();
_visible = false;

第二帧:
var rad = -_root.ang/180*Math.PI;
_x = _root.gun_mc._x+80*Math.cos(rad);
_y = _root.gun_mc._y-80*Math.sin(rad);
var Vx = Math.sqrt(750)*Math.cos(rad);
var Vy = -1*Math.sqrt(750)*Math.sin(rad);
_visible = true;

第三帧:
var hitMon = this.hitTest(_root.fly);
if (hitMon) {
gotoAndPlay("HitBang");
}
_x += Vx;
_y += Vy;
Vy++;
if (_y>=350 || _x>550) {
gotoAndPlay("Bang");
}
trace(1);

第四帧:
gotoAndPlay (_currentframe-1);

第16帧:
gotoAndStop(1);

第17 帧
:_root.fly.removeMovieClip();
_root.total++;

第26帧
:_root.attachMovie("fly", "fly", 10, {_x:random(300)+220, _y:random(220)+10});
gotoAndStop(1);
//------------------------------------------

你也可以试试.
文章录入:skyuu    责任编辑:skyuu 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    发表评论:
    姓名:  评 分: 1分 2分 3分 4分 5分
     
  • 严禁发表危害国家安全、政治、黄色淫秽等内容的评论。
  • 用户需对自己在使用幽幽天空服务过程中的行为承担法律责任。
  • 本站管理员有权保留或删除评论内容。
  • 评论内容只代表机友个人观点,与本网站立场无关。