用户名: 密码: 验证码: QQ--程序群:31736530 动画群:38836599
闪无忧
 
首 页 业界新闻 业界杂谈 Flash教程 Flash源码 Flash图书 Flash酷站 Flex & AIR 供求信息
   本栏目通告:   有意向写收费精品教程的朋友,请联系本站合作
当前位置 :首页>flash教程>Flash应用开发>列表

俄罗斯方块(游戏制作)

[来源:闪客无忧 | 作者:闪灵凶猛 | 时间:2008-03-28 | 点击:  | 收藏本文  【 】]

(1)创建一个影片剪辑元件“水平边界”,在其中绘制一条长度为240px的水平直线,将其对齐元件中心。
(2)创建一个影片剪辑元件“竖直边界”,在其中绘制一条长度为400px的竖直直线,将其对齐元件中心。
(3)创建一个影片剪辑元件“界面”,使用矩形工具绘制一个240×400的渐变色矩形。
(4)使用矩形工具绘制一个160×300的白色矩形,将其放置到渐变色矩形中。
(5)选中白色矩形,按【Delete】键将其删除,使渐变色矩形呈挖空状态。
(6)新建一个图层,在其中添加制作好的按钮。
(7)再添加两个动态文本框。
(8)将显示为“4”的动态文本变量设置为“v”。
(9)将显示为“00000”的动态文本变量设置为“score”。
(10)回到主场景,将背景大小设置为240×400,背景颜色设置为#CCCCCC。
(11)在第2帧插入空白关键帧,将元件“水平边界”拖放到场景中,将其实例命名为“base”。
(12)将元件“竖直边界”拖出两个到场景中,将左边的实例命名为“left”,将右边的实例命名为“right”。其中,实例“left”的x坐标为35,实例“right”的x坐标为205。
(13)将元件“界面”拖放到第2帧的场景中,在“属性”面板中将其实例命名为“top”。
(14)在第3帧插入空白关键帧,将元件“重新开始-剪辑”拖放到场景中。
1.2.4 添加程序代码
该游戏用到的代码稍稍有些复杂,下面进行逐一添加。
(1)选中主时间轴中的第1帧,按【F9】键打开其“动作”面板,在其中添加如下代码:

 

function hitothers(xx, yy, num, rot) {

switch (num) {
case 1 :
switch (rot) {
case 0 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10+1;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case 90 :
x1 = (xx-40)/10;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10-1;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10;
break;
case 180 :
x1 = (xx-40)/10;
y1 = (330-yy)/10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
x3 = (xx-40)/10-2;
y3 = (330-yy)/10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10+1;
break;
case -90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10;
break;
}
break;
case 2 :
switch (rot) {
case 0 :
x1 = (xx-40)/10-2;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10+1;
break;
case 90 :
x1 = (xx-40)/10;
y1 = (330-yy)/10+2;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10;
y4 = (330-yy)/10-1;
break;
case 180 :
x1 = (xx-40)/10-2;
y1 = (330-yy)/10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10;
break;
case -90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10-1;
break;
}
break;
case 3 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10;
break;
case 4 :
switch (rot) {
case 0 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10;
break;
case 90 :
x1 = (xx-40)/10;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10-1;
break;
case 180 :
x1 = (xx-40)/10-2;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case -90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10;
y4 = (330-yy)/10+2;
break;
}
break;
case 5 :
switch (rot) {
case 0 :
x1 = (xx-40)/10-2;
y1 = (330-yy)/10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10;
y4 = (330-yy)/10+1;
break;
case 90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case 180 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10+1;
break;
case -90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10;
y4 = (330-yy)/10-1;
break;
}
break;
case 6 :
switch (rot) {
case 0 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10;
break;
case 90 :
x1 = (xx-40)/10;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10-1;
break;
case 180 :
x1 = (xx-40)/10-2;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case -90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10;
y4 = (330-yy)/10+2;
break;
}
break;
case 7 :
switch (rot) {
case 0 :
x1 = (xx-40)/10-2;
y1 = (330-yy)/10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10;
y4 = (330-yy)/10+1;
break;
case 90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case 180 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10+1;
break;
case -90 :
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
x4 = (xx-40)/10;
y4 = (330-yy)/10-1;
break;
}
break;
}
if ((_root.box[y1][x1] == 1) || (_root.box[y2][x2] == 1) || (_root.box[y3][x3] == 1) || (_root.box[y4][x4] == 1)) {
_root.hit = true;
} else {
_root.hit = false;
}
}
function attachsquares(xx, yy, num, rot) {
switch (num) {
case 1 :
switch (rot) {
case 0 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10+1;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case 90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y+10;
x3 = (xx-40)/10;
y3 = (330-yy)/10-1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10;
break;
case 180 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-20;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10-2;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10+1;
break;
case -90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-20;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10;
break;
}
break;
case 2 :
switch (rot) {
case 0 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-20;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-2;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-10;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10+1;
break;
case 90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x;
_root["w"+_root.iii]._y = _root.currentmove._y-20;
x1 = (xx-40)/10;
y1 = (330-yy)/10+2;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y+10;
x4 = (xx-40)/10;
y4 = (330-yy)/10-1;
break;
case 180 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-20;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-2;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10;
break;
case -90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-20;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y+10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10-1;
break;
}
break;
case 3 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10;
break;
case 4 :
switch (rot) {
case 0 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10;
break;
case 90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y+10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10-1;
break;
case 180 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-20;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-2;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case -90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-20;
x4 = (xx-40)/10;
y4 = (330-yy)/10+2;
break;
}
break;
case 5 :
switch (rot) {
case 0 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-20;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-2;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-10;
x4 = (xx-40)/10;
y4 = (330-yy)/10+1;
break;
case 90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-20;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case 180 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-10;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10+1;
break;
case -90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y+10;
x4 = (xx-40)/10;
y4 = (330-yy)/10-1;
break;
}
break;
case 6 :
switch (rot) {
case 0 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10;
break;
case 90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y+10;
x4 = (xx-40)/10-1;
y4 = (330-yy)/10-1;
break;
case 180 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-20;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-2;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case -90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-20;
x4 = (xx-40)/10;
y4 = (330-yy)/10+2;
break;
}
break;
case 7 :
switch (rot) {
case 0 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-20;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-2;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-10;
x4 = (xx-40)/10;
y4 = (330-yy)/10+1;
break;
case 90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-20;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+2;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10-1;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y;
x4 = (xx-40)/10;
y4 = (330-yy)/10;
break;
case 180 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x-10;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10-1;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y-10;
x3 = (xx-40)/10;
y3 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x+10;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y-10;
x4 = (xx-40)/10+1;
y4 = (330-yy)/10+1;
break;
case -90 :
_root.attachMovie("square", "w"+_root.iii, 100+_root.iii);
_root["w"+_root.iii]._x = _root.currentmove._x-10;
_root["w"+_root.iii]._y = _root.currentmove._y-10;
x1 = (xx-40)/10-1;
y1 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+1), 100+_root.iii+1);
_root["w"+(_root.iii+1)]._x = _root.currentmove._x;
_root["w"+(_root.iii+1)]._y = _root.currentmove._y-10;
x2 = (xx-40)/10;
y2 = (330-yy)/10+1;
_root.attachMovie("square", "w"+(_root.iii+2), 100+_root.iii+2);
_root["w"+(_root.iii+2)]._x = _root.currentmove._x;
_root["w"+(_root.iii+2)]._y = _root.currentmove._y;
x3 = (xx-40)/10;
y3 = (330-yy)/10;
_root.attachMovie("square", "w"+(_root.iii+3), 100+_root.iii+3);
_root["w"+(_root.iii+3)]._x = _root.currentmove._x;
_root["w"+(_root.iii+3)]._y = _root.currentmove._y+10;
x4 = (xx-40)/10;
y4 = (330-yy)/10-1;
break;
}
break;
}
_root.box[y1][x1] = 1;
_root.box[y2][x2] = 1;
_root.box[y3][x3] = 1;
_root.box[y4][x4] = 1;
_root.iii += 4;
judgescore();
}
function judgescore() {
if (_root.box[29][6] == 1 || _root.box[29][7] == 1 || _root.box[29][8] == 1 || _root.box[29][9] == 1 || _root.box[29][10] == 1) {
nextFrame();
}
_root.fill1 = -1;
_root.fill2 = -1;
_root.fill3 = -1;
_root.fill4 = -1;
for (var m = 0; m<=29; m++) {
_root.gain = true;
for (var n = 0; n<=15; n++) {
if (_root.box[m][n] == 0) {
_root.gain = false;
}
}
if (_root.gain == true) {
_root.fill1 = m;
}
}
if (_root.fill1 != -1) {
_root.top.score = Number(_root.top.score)+100;
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y == 330-_root.fill1*10) {
_root["w"+z].removeMovieClip();
}
}
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y<330-_root.fill1*10) {
_root["w"+z]._y += 10;
}
}
for (var c = _root.fill1; c<=28; c++) {
for (var d = 0; d<=15; d++) {
_root.box[c][d] = _root.box[c+1][d];
}
}
for (var m = 0; m<=29; m++) {
_root.gain = true;
for (var n = 0; n<=15; n++) {
if (_root.box[m][n] == 0) {
_root.gain = false;
}
}
if (_root.gain == true) {
_root.fill2 = m;
}
}
if (_root.fill2 != -1) {
_root.top.score = Number(_root.top.score)+200;
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y == 330-_root.fill2*10) {
_root["w"+z].removeMovieClip();
}
}
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y<330-_root.fill2*10) {
_root["w"+z]._y += 10;
}
}
for (var c = _root.fill2; c<=28; c++) {
for (var d = 0; d<=15; d++) {
_root.box[c][d] = _root.box[c+1][d];
}
}
for (var m = 0; m<=29; m++) {
_root.gain = true;
for (var n = 0; n<=15; n++) {
if (_root.box[m][n] == 0) {
_root.gain = false;
}
}
if (_root.gain == true) {
_root.fill3 = m;
}
}
if (_root.fill3 != -1) {
_root.top.score = Number(_root.top.score)+300;
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y == 330-_root.fill3*10) {
_root["w"+z].removeMovieClip();
}
}
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y<330-_root.fill3*10) {
_root["w"+z]._y += 10;
}
}
for (var c = _root.fill3; c<=28; c++) {
for (var d = 0; d<=15; d++) {
_root.box[c][d] = _root.box[c+1][d];
}
}
for (var m = 0; m<=29; m++) {
_root.gain = true;
for (var n = 0; n<=15; n++) {
if (_root.box[m][n] == 0) {
_root.gain = false;
}
}
if (_root.gain == true) {
_root.fill4 = m;
}
}
if (_root.fill4 != -1) {
_root.top.score = Number(_root.top.score)+400;
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y == 330-_root.fill4*10) {
_root["w"+z].removeMovieClip();
}
}
for (var z = 0; z<=_root.iii; z++) {
if (_root["w"+z]._y<330-_root.fill4*10) {
_root["w"+z]._y += 10;
}
}
for (var c = _root.fill4; c<=28; c++) {
for (var d = 0; d<=15; d++) {
_root.box[c][d] = _root.box[c+1][d];
}
}
}
}
}
}
_root.fill1 = -1;
_root.fill2 = -1;
_root.fill3 = -1;
_root.fill4 = -1;
}

上一页 1 23 4 下一页
文章如果有错误或者缺少文件,请发邮件提交给我们
上一篇:flash游戏中动态加载地图的问题
下一篇:flash游戏组件的创建、打包和运用全过程
Tags:     制作 游戏 罗斯 _root.iii /10 _root xx-40 330-yy ._y
>>> 最新评论:(共有 0 位网友发表了评论)      查看所有评论
  发表评论
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
·本站发布内容均为客观表达作者观点,不代表闪无忧立场,请勿攻击和漫骂
·用户发表意见仅代表其个人意见,并且承担一切因发表内容引起的纠纷和责任
·本站管理人员有权在不通知用户的情况下删除不符合规定的评论信息或留做证据
·请客观的评价您所看到的资讯,提倡就事论事,杜绝漫骂和人身攻击等不文明行为
  教程分类
  基础操作   动画特效
  应用开发   组件学习
  As程序   动画教程
  Flash cs3   AS 3.0
  FCS/FMS教程   Loading教程
  Flash与Web   Flash教程连载
  相关文章
·Rectangle对象在flash游戏开发中
·Flash的Socket和AMF3的研究心得
·Flash的Socket和AMF3来开发web游
·制作有视角的迷宫游戏+碰撞
·项目外包, 诚要天下FLASH有能之
·flash小游戏制作:月饼消消看
·Flash Player10功能SaveBitmap直
·面向对象法制作贪吃蛇小游戏
·flash里键盘控制人物行走的另个
·flash中图形位置的半像素渲染问
  热门文章
·Flash进度条的制作详细讲解(组图)
·flash幻灯片网页效果
·Flex 3 AdvancedDataGrid的使用(第二
·全Flash动画网站实现的基础教学
·flash水影效果字
·Flash打造简单的飘雪动画视觉特效
·FLASH+XML相册(附源码)
·超酷flash光晕移动效果
·Flash旋转拖尾文字效果的制作教程
·Flash制作大雪纷飞效果动画
·flash春雷闪电效果
关于我们 - 免责声明 - 网站地图 - 商务服务 - 联系我们 - RSS地图
©CopyRight 2006-2008, 5UFlash.COM, Inc. All Rights Reserved
鲁ICP备06034971号