 |
教程: Flash教程-Flash游戏实例教程-Flash中背景跟随时间变化 |
 |
|
|
| 教程: Flash教程-Flash游戏实例教程-Flash中背景跟随时间变化 |
|
|
|
|
1110) { skycolor = [83 - (nowtime - 1080) * 0.433000, 111 - (nowtime - 1080) * 5.100000, 83 - (nowtime - 1080) * 0.433000, -5 - (nowtime - 1080) * 1.233000, 65 (nowtime - 1080) * 0.366700, 13 - (nowtime - 1080) * 2, 100, 0]; } // end if if (nowtime > 1110 && nowtime <= 1200) { skycolor = [70 - (nowtime - 1110) * 0.722000, -42 (nowtime - 1110) * 0.667000, 70 - (nowtime - 1110) * 0.700000, -42 (nowtime - 1110) * 0.310000, 76 - (nowtime - 1110) * 0.522000, -47 (nowtime - 1110) * 0.411000, 100, 0]; } // end if sk = new Color(sky); x1 = ; sk.setTransform(x1); m1 = new Color(mc1); x2 = ; m1.setTransform(x2); m2 = new Color(mc2); x3 = ; m2.setTransform(x3); m3 = new Color(mc3); x4 = ; m3.setTransform(x4); m4 = new Color(mc4); x5 = ; m4.setTransform(x5); d = new Color(dao); x6 = ; d.setTransform(x6); y1 = new Color(yun1); y2 = new Color(yun2); y3 = new Color(yun3); sun = new Color(mc5); x7 = ; y1.setTransform(x7); y2.setTransform(x7); y3.setTransform(x7); sun = new Color(mc5); sun.setTransform(x4); sky2 = new Color(_root.home.all.sky2); sky2.setTransform(x1); } // End of the function function suntimes() { if (nowtime >= 540 && nowtime <= 900) { mc5._y = -45; if (nowtime <= 720) { mc5._rotation = 180 (nowtime - 540) * 0.388000; } // end if if (nowtime > 720) { mc5._rotation = 250 (nowtime - 720) * 0.611000; } // end if } else { if (nowtime < 540 && nowtime >= 360) { mc5._y = 180 - (nowtime - 360) * 1.250000; mc5._rotation = 180; } // end if if (nowtime >= 900 && nowtime <= 1110) { mc5._y = -45 (nowtime - 900) * 0.900000; mc5._rotation = 0; } // end if if (nowtime >= 0 && nowtime < 360 || nowtime > 1100 && nowtime <= 1440) { mc5._alpha = 0; } else { mc5._alpha = 100; } // end if } // end if if (nowtime > 360 && nowtime <= 720) { mc5.sun._xscale = 130 - (nowtime - 360) * 0.166700; mc5.sun._yscale = mc5.sun._xscale; } else if (nowtime > 720 && nowtime <= 1080) { mc5.sun._xscale = 70 (nowtime - 720) * 0.166700; mc5.sun._yscale = mc5.sun._xscale; } // end if } // End of the function function moontimes() { if (nowtime >= 1260 && nowtime < 1440 || nowtime >= 0 && nowtime < 180) { moon._y = -45; if (nowtime < 1440) { moon._rotation = 180 (nowtime - 1260) * 0.388900; } // end if if (nowtime >= 0 && nowtime < 180) { moon._rotation = 250 nowtime * 0.611000; } // end if } else { if (nowtime < 1260 && nowtime > 1080) { moon._y = 75 - (nowtime - 1080) * 0.666700; moon._rotation = 180; } // end if if (nowtime > 180 && nowtime < 1080) { moon._y = -45 (nowtime - 180) * 0.666700; moon._rotation = 0; } // end if } // end if if (nowtime >= 1080 && nowtime <= 1260) { moon._alpha = Math.round((nowtime - 1080) * 0.555600); star._alpha = Math.round((nowtime - 1080) * 0.555600); } // end if if (nowtime > 1260 && nowtime < 1440 || nowtime > 0 && nowtime < 240) { moon._alpha = 100; star._alpha = 100; } // end if if (nowtime >= 240 && nowtime <= 360) { moon._alpha = 100 - Math.round((nowtime - 240) * 0.833300); star._alpha = 100 - Math.round((nowtime - 240) * 0.833300); } // end if if (nowtime > 360 && nowtime < 1080) { moon._alpha = 0; star._alpha = 0; } // end if if (nowtime > 1080 && nowtime < 1440) { moon.moons._xscale = 130 - (nowtime - 1080) * 0.138890; moon.moons._yscale = moon.moons._xscale; } else if (nowtime > 0 && nowtime <= 360) { moon.moons._xscale = 80 nowtime * 0.138890; moon.moons._yscale = moon.moons._xscale; } // end if } // End of the function var hh; var xiaoshi; var mm; var ss; var fengzhong; var nowtime; MovieClip.prototype.moveIn = function () { var _l1 = this; _l1.onEnterFrame = function () { var _l1 = this; if (_l1._currentframe < _l1._totalframes) { _l1.nextFrame(); } else { delete _l1["onEnterFrame"]; } // end if }; }; MovieClip.prototype.moveOut = function () { var _l1 = this; _l1.gotoAndStop(_l1._totalframes); _l1.onEnterFrame = function () { var _l1 = this; if (_l1._currentframe > 1) { _l1.prevFrame(); } else { delete _l1["onEnterFrame"]; } // end if }; }; onEnterFrame = function () { ss = new Date(); miao = ss.getSeconds(); if (miao == 59) { times(); suntimes(); moontimes(); } // end if };
特别说明:这个代码最下面不是用来控制背景变化的,而是用来控制到了晚上月亮出现的位置,星星的位置。白天这些画面消失的控制。由于时间缘故。本人没有将这些画面放上了。如果大家感兴趣的话。我后面会完成的。
上一页 [1] [2] [3] 下一页
|
|
| 教程录入:admin 责任编辑:admin |
|
|
上一篇教程: 教程: Flash教程-Flash游戏实例教程-Flash 游戏制作:抢手棋
下一篇教程: 教程: Flash教程-Flash游戏实例教程-用flash制作简单拼图游戏 |
|
|
|
|
|
|
|
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |
|
|
|
|
|