上海建桥学院本科实验报告课程名称:互动媒体制作学号:姓名:专业:数字媒体艺术班级:指导教师:课内实验目录及成绩信息技术学院2012年12 月 1 日上海建桥学院实验报告课程名称:互动媒体制作实验类型:验证型实验项目名称:交互事件动画(星星亮满天)实验地点:多媒体机房实验日期:2013 年 3 月7 日一、实验目的和要求1、熟悉的运用;2、巩固AS3.0的程序结构和基本语法;3、能够创建和调用系统函数;4、能够熟练运用程序基本结构;5、制作满足相应指标要求的正确运行的小游戏;二、实验内容和原理1、使用显示对象、对象点击事件、三大元件等编写交互功能2、程序的基本结构包括:顺序结构、选择结构、循环结构3、事件函数:MouseEvent事件类4、时间函数:Timer类三、主要仪器设备或环境PC机;Flash cs5.5(或以上);Photoshop cs5(或以上);移动终端5套。
四、操作方法与实验步骤1、确定游戏的主题(名称、色彩配置、主题思想、使用方法等)名称:星星亮满天色彩配置:深邃的天空+颜色随机的星星主题思想:在背景天空区域,左键单击星星出现,并且颜色随机使用方法:鼠标左键单击2、确定游戏的设计流程图3、游戏素材的采集、导入或制作导入图片bg,并转成元件导入图片星光,并制作成动画4、关键的操作步骤(含主要代码)及技巧星光转换成元件,并制作动画,达到星星从大到小,从小到大的变化。
然后将此元件再次转换,并再次制作动画,共5帧,每帧星星颜色不一样。
在bg上的天空上制作一个遮罩层mc ,并对mc添加一个鼠标监听。
mc.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2);function fl_MouseClickHandler_2(event:MouseEvent):void{var mystar:star=new star();mystar.x=mouseX;mystar.y=mouseY;//改大小/颜色mystar.stop();var randomNum:int=Math.floor(Math.random()*5+1);mystar.width=mystar.height=Math.random()*60+30;mystar.gotoAndStop(randomNum);addChild(mystar);trace("已单击鼠标");}五、实验结果注:可用贴图的方式1、主要使用的AS3.0的知识点添加鼠标监听、实例对象显示在鼠标点击的位置(mystar.x=mouseX; mystar.y=mouseY;)、数学函数(随机数、向下取整)、gotoAndStop2、小游戏的效果(至少给出3个,含制作过程及结果)六、实验总结注:包括制作过程中出现的问题,实验心得体会及改进意见等在老师的带领下完成了此次小游戏,初次体验到Flash的神奇,特别是随机数的出现。
在这种浓烈的兴趣下,我将更认真的学习Flash。
上海建桥学院实验报告课程名称:互动媒体制作实验类型:设计型实验项目名称:文字回合类游戏制作(面向过程及时间函数)实验地点:多媒体机房实验日期:2013 年 3 月21 日一、实验目的和要求1、巩固面向对象编程的相关概念;2、构造函数的创建和使用;3、事件处理机制及Event类的创建、使用(事件侦听器);4、能够熟练运用鼠标事件;5、制作满足要求的动画效果;二、实验内容和原理1、使用事件驱动编写AS3.0应用程序(物体移动等的动画效果)2、鼠标事件:CLICK、MOUSE_MOVE、MOUSE_OVER、MOUSE_OUT、MOUSE_WHEEL等3、键盘事件:KeyboardEvent.KEY_DOWN(UP)等4、时间函数:TimerEvent.TIMER、TimerEvent.TIMER _COMPLETE三、主要仪器设备或环境PC机;Flash cs5.5(或以上);Photoshop cs5(或以上);移动终端5套。
四、操作方法与实验步骤1、确定作品的主题(名称、色彩配置、主题思想、使用方法等)名称:勇者斗恶龙主题思想:为了描写战斗,对勇者与恶龙设置特性,如名字,攻击力,防御力以及速度,运行游戏,出现打斗文字。
使用方法:结果显示在输入框里2、主题作品的设计运行游戏后,勇者与恶龙轮流发动攻击,最后得出胜负。
3、素材的导入或制作没有素材的导入4、关键的操作步骤(含主要代码)及技巧var hero:Object = new Object();var monster:Object = new Object(); = "勇者";hero.HP = 500;hero.ATT = 90;hero.DEF = 88;hero.AGI = 60;hero.skill1 = "普通攻击";hero.skill2 = "飞刃闪";hero.skill3 = "极光剑"; = "恶龙";monster.HP = 1000;monster.ATT = 120;monster.DEF = 100;monster.AGI = 22;monster.skill1 = "攻击";monster.skill2 = "龙尾击";monster.skill3 = "毁灭光线";var timer:Timer = new Timer(1000);timer.addEventListener(TimerEvent.TIMER, round) timer.start();function whoAttacks(a:Object,b:Object):Array{return a.AGI*Math.random() > b.AGI*Math.random() ? [a,b]:[b,a];}function round(e:TimerEvent):void{var damage:Number;var skillIndex:uint;var roundFight:Array = whoAttacks(hero,monster);var attacker:Object = roundFight[0];var defender:Object = roundFight[1];damage = attacker.ATT*Math.random() - defender.DEF * Math.random();if(damage <= 0){damage = 0;}else{damage = Math.ceil(damage);}defender.HP -= damage;if(damage < attacker.ATT / 3){skillIndex = 1;}else if(damage < attacker.ATT *2/ 3){skillIndex = 2;}else{skillIndex = 3;}trace( + "向" + + "发动了"+attacker["skill"+skillIndex] + ","+ + "损失了" + damage + "点HP!");if(defender.HP <= 0){trace( + "终于支持不住,倒下了!\n"+ + "取得了胜利!");timer.removeEventListener(TimerEvent.TIMER, round);trace("\nGame Over");return;}trace( + " HP:" + hero.HP + "\t"+ + " HP:" + monster.HP);}五、实验结果注:可用贴图的方式1、主要使用的知识点使用事件驱动编写AS3.0应用程序(物体移动等的动画效果)鼠标事件:CLICK、MOUSE_MOVE、MOUSE_OVER、MOUSE_OUT、MOUSE_WHEEL等键盘事件:KeyboardEvent.KEY_DOWN(UP)等时间函数:TimerEvent.TIMER、TimerEvent.TIMER _COMPLETE2、作品的效果图(至少给出3个,含制作过程及结果)六、实验总结注:包括制作过程中出现的问题,实验心得体会及改进意见等大体上了解到我们平常玩的回合游戏的制作过程,很有趣,我很喜欢这个。
不过我想要是加上图片和效果的话,难度会提升很多。
上海建桥学院实验报告课程名称:互动媒体制作实验类型:设计型实验项目名称:找茬类事件点击类小游戏实验地点:多媒体机房实验日期:2013 年 4 月15 日一、实验目的和要求1、巩固AS3.0中核心类及显示对象的相关概念;2、学会MovieClip类、Sprite类的创建及使用;3、学会AS3.0中创建动画的几种方式;4、能够熟练运用显示对象的属性;5、能够熟练运用timer类创建动画(效果);6、制作满足相应要求的交互动画;二、实验内容和原理1、确定内容健康的主题2、相关素材的准备3、制作交互动画的流程图(分镜头脚本)4、运用Timer类控制显示对象的属性来制作交互动画三、主要仪器设备或环境PC机;Flash cs5(或以上);Photoshop cs5(或以上);移动终端5套;数码照相机1台;数码摄像机1台;数位板1个。
四、操作方法与实验步骤1、确定主题、设计流程图主题:找茬游戏设计流程图:2、游戏整体流程拆分游戏开始初始化:开始按钮定义、开始界面的设置、初始化数值游戏主题部分:添加三个文本框,一个计分数,一个倒计时,一个统计剩余几个错找到几个错。
添加Timer时间监听,用来倒计时。
对cuowumian、cuo1、cuo2、cuo3.、cuo4.、cuo5添加鼠标事件监听,MouseEvent.CLICK。
游戏结束部分:移除游戏主体页面上所有东西,移除监听。
根据找出的错的个数判断是否通关,并显示在名为tf的文本框里。
添加一个Restart按钮,实现重玩的功能。
3、三大游戏流程部分功能实现游戏开始初始化、开始界面的设置;myStartView =new StartView();addChild(myStartView);myStartView.x = stage.stageWidth / 2;myStartView.y = stage.stageHeight / 2;游戏正式界面设置function gameStart(){scoreField=new TextField();scoreFn();addChild(scoreField);myGameView=new GameView();addChild(myGameView);myGameView.x = stage.stageWidth / 2;myGameView.y = stage.stageHeight / 2;allTimer = 10;timer = new Timer(1000,20);timer.addEventListener(TimerEvent.TIMER,timerFn);timer.start();timeField=new TextField();timeField.autoSize = "center";timeField.text = "你还有" + allTimer + "秒";timeField.x = 400;addChild(timeField);myGameView.cuo1.stop();myGameView.cuo2.stop();myGameView.cuo3.stop();myGameView.cuo4.stop();myGameView.cuo5.stop();myGameView.cuowumian.addEventListener(MouseEvent.CLICK,mianFn);myGameView.cuo1.addEventListener(MouseEvent.CLICK,cuo1Fn);myGameView.cuo2.addEventListener(MouseEvent.CLICK,cuo2Fn);myGameView.cuo3.addEventListener(MouseEvent.CLICK,cuo3Fn);myGameView.cuo4.addEventListener(MouseEvent.CLICK,cuo4Fn);myGameView.cuo5.addEventListener(MouseEvent.CLICK,cuo5Fn);}游戏结束function endGame(){removeChild(myGameView);removeChild(scoreField);removeChild(timeField);myGameView.cuowumian.removeEventListener(MouseEvent.CLICK,mianFn);tf=new TextField();tf.width = 300;if (score==5) { tf.text = "恭喜你通关了"; }else { tf.text = "很遗憾,请大侠重新来过"; }var format:TextFormat = new TextFormat();format.font = "_sans";format.color = 0xFF0000;format.size = 50;format.underline = true;tf.x=(stage.stageWidth-tf.width )/2;tf.y=(stage.stageHeight-tf.height )/2;tf.autoSize = "center";tf.defaultTextFormat = format;addChild(tf);myGameView.cuowumian.removeEventListener(MouseEvent.CLICK,mianFn);myEndBt=new Button();addChild(myEndBt);bel = "Restart";myEndBt.x=(stage.stageWidth-myEndBt.width )/2;myEndBt.y = 300;myEndBt.addEventListener(MouseEvent.CLICK,restartFn);}4、游戏主体部分操作步骤(含主要代码)及技巧import fl.controls.Button;import flash.events.MouseEvent;import flash.utils.Timer;import fl.motion.MotionEvent;import flash.text.TextField;import flash.display.Sprite;import flash.text.TextField;import flash.text.TextFormat;var allScore:int = 5;var myStartBt:Button;var myStartView:StartView;var myGameView:GameView;var myEndBt:Button;var timer:Timer;var score:int;var scoreField:TextField;var tf:TextField;var allTimer:int;var timeField:TextField;init();//游戏开始初始化function init(){//开始按钮定义myStartBt=new Button ();addChild(myStartBt);myStartBt.x=(stage.stageWidth-myStartBt.width )/2;myStartBt.y = 300;bel = "Start";myStartBt.addEventListener(MouseEvent.CLICK,myStartBtFn);//开始界面的设置;myStartView =new StartView();addChild(myStartView);myStartView.x = stage.stageWidth / 2;myStartView.y = stage.stageHeight / 2;//数值初始化score = 0;}function myStartBtFn(e:MouseEvent ){removeChild(myStartBt);removeChild(myStartView);myStartBt.removeEventListener(MouseEvent.CLICK,myStartBtFn );gameStart();}//游戏正式界面设置function gameStart(){scoreField=new TextField();scoreFn();addChild(scoreField);myGameView=new GameView();addChild(myGameView);myGameView.x = stage.stageWidth / 2;myGameView.y = stage.stageHeight / 2;allTimer = 10;timer = new Timer(1000,20);timer.addEventListener(TimerEvent.TIMER,timerFn);timer.start();timeField=new TextField();timeField.autoSize = "center";timeField.text = "你还有" + allTimer + "秒";timeField.x = 400;addChild(timeField);myGameView.cuo1.stop();myGameView.cuo2.stop();myGameView.cuo3.stop();myGameView.cuo4.stop();myGameView.cuo5.stop();myGameView.cuowumian.addEventListener(MouseEvent.CLICK,mianFn);myGameView.cuo1.addEventListener(MouseEvent.CLICK,cuo1Fn);myGameView.cuo2.addEventListener(MouseEvent.CLICK,cuo2Fn);myGameView.cuo3.addEventListener(MouseEvent.CLICK,cuo3Fn);myGameView.cuo4.addEventListener(MouseEvent.CLICK,cuo4Fn);myGameView.cuo5.addEventListener(MouseEvent.CLICK,cuo5Fn);} function timerFn(e:TimerEvent){allTimer--;timeField.text = "你还有" + allTimer + "秒";if (allTimer<0) {timer.stop();timer.removeEventListener(TimerEvent.TIMER,timerFn);endGame(); }}function mianFn(e:MouseEvent){allTimer--;}function scoreFn(){scoreField.text="已找到"+String(score)+"错,剩余"+String(allScore-score)+"处错";scoreField.width = 300;}function cuo1Fn(e:MouseEvent){myGameView.cuo1.removeEventListener(MouseEvent.CLICK,cuo1Fn);myGameView.cuo1.gotoAndStop(2);score++;scoreFn();allTimer+=2;trace(score);if (score==5) {timer.stop();endGame(); }}function cuo2Fn(e:MouseEvent){myGameView.cuo2.removeEventListener(MouseEvent.CLICK,cuo2Fn);myGameView.cuo2.gotoAndStop(2);score++;scoreFn();allTimer+=2;trace(score);if (score==5) {endGame(); }}function cuo3Fn(e:MouseEvent){myGameView.cuo3.removeEventListener(MouseEvent.CLICK,cuo3Fn);myGameView.cuo3.gotoAndStop(2);score++;scoreFn();allTimer+=2;trace(score);if (score==5) {timer.stop();endGame(); }}function cuo4Fn(e:MouseEvent){myGameView.cuo4.removeEventListener(MouseEvent.CLICK,cuo4Fn);myGameView.cuo4.gotoAndStop(2);score++;scoreFn();allTimer+=2;trace(score);if (score==5) {timer.stop();endGame(); }}function cuo5Fn(e:MouseEvent){myGameView.cuo5.removeEventListener(MouseEvent.CLICK,cuo5Fn);myGameView.cuo5.gotoAndStop(2);score++;scoreFn();allTimer+=2;trace(score);if (score==5) {endGame();}}//游戏结束function endGame(){removeChild(myGameView);removeChild(scoreField);removeChild(timeField);myGameView.cuowumian.removeEventListener(MouseEvent.CLICK,mianFn);tf=new TextField();tf.width = 300;if (score==5) {tf.text = "恭喜你通关了"; }else {tf.text = "很遗憾,请大侠重新来过"; }var format:TextFormat = new TextFormat();format.font = "_sans";format.color = 0xFF0000;format.size = 50;format.underline = true;tf.x=(stage.stageWidth-tf.width )/2;tf.y=(stage.stageHeight-tf.height )/2;tf.autoSize = "center";tf.defaultTextFormat = format;addChild(tf);myGameView.cuowumian.removeEventListener(MouseEvent.CLICK,mianFn);myEndBt=new Button();addChild(myEndBt);bel = "Restart";myEndBt.x=(stage.stageWidth-myEndBt.width )/2;myEndBt.y = 300;myEndBt.addEventListener(MouseEvent.CLICK,restartFn);}function restartFn(e:MouseEvent){myEndBt.removeEventListener(MouseEvent.CLICK,restartFn);removeChild(myEndBt);removeChild(tf);init();}五、实验结果注:可用贴图的方式1、主要使用的知识点运用Timer类控制显示对象的属性来制作交互动画2、交互动画的效果(至少给出3个,含制作过程及结果)六、实验总结注:包括制作过程中出现的问题,实验心得体会及改进意见等这算目前为止做的最完整的一个游戏了,很有挑战性,我多添加了两张图片,成了有3个关卡的游戏,很有趣。