制作flash换装小游戏 按钮代码 (flash游戏代码)

2023-03-26 15:05:46 游戏资讯 坑剧哥

很简单先举个例子:

我们假设制作不同发型切换。先制作一个“影片剪辑”每一帧在相应重叠位置的坐标上画好不同的发型,比如第一帧是短发,第二帧是长发,第三帧是光头。

然后回到总场景,用文本工具弄一个“动态文本”,把动态文本的“变量”,输入上一个你需要的代号,我在这里就把它输入为【代号发型】,然后在动态文本框里面输入数字“1”,代表是默认的数字,也就是短发。

然后把你刚才制作的3帧的影片剪辑拖放到场景中,给他命名为【发型替换】,当然别忘了在影片剪辑里面的第一帧动作中输入stop();不然会自动播放,发型会像动画一样滚动。。。。输入这个命令是为了让画面固定到第一个发型上。

然后建立2个按钮,一个是“+”,一个是“-”,用于前进还是后退发型编号。

“+”按钮:点击按钮,在“动作”里面写入编码:(“//”后面为我的解释。)

on

(release)

{

//按钮触发的代码,意思是"当按钮按下后,又松开,需要触发的内容"

代号发型

=

代号发型-(-1);

//每点击一次按钮,代号发型数字+1

if

(代号发型

==

1)

{

//如果代号发型值为1

发型替换.gotoandstop(1);

//那么发型替换影片剪辑就显示第一帧,也就是短发

}

if

(代号发型

==

2)

{

发型替换.gotoandstop(2);

//那么发型替换影片剪辑就显示第二帧,也就是长发.....

}

if

(代号发型

==

3)

{

发型替换.gotoandstop(3);

}

if

(代号发型

==

4)

{

//最后,如果是4

代号发型

=

1;

//那么值返回第一个短发

发型替换.gotoandstop(1);

//图像也跟着回到第一帧显示短发

}

}

当然这是渐进型的..还有一个方式是点击相应图片换相应衣服....

那个其实跟这个差不多....

就是,每一种发型,都制作为一个按钮,然后,在不同发型按钮中输入不同的代码,区别就是

发型替换.gotoandstop(第几帧);

明白了么

-

-!?

flash游戏代码(flash做游戏代码) 第1张

flash小游戏源代码如何导出

方法如下:

首先是获取到网页中的游戏文件,也就是swf格式的文件,可以到网页缓存或者在开发人员工具里监测加载数据获取。然后要区分是页游还是小游戏。

FLASH转盘游戏的制作代码问题

这个就是你要的代码!

function getCellStart()

{

spdLoop = setInterval(spdRun, 60);

} // End of the function

function getCellStop()

{

clearInterval(spdLoop);

cell_mc.speed_mc.stop();

loadBingoPos();

} // End of the function

function spdRun()

{

cell_mc.speed_mc.play();

} // End of the function

function trans(v)

{

var _l1 = Math.floor((25 - Math.abs(v - 25)) / 5) + 1;

if (_l1 == 5)

{

_l1 = 4;

} // end if

return(_l1);

} // End of the function

function rollRun(v)

{

pst = v;

aoo = pst * 10;

pointerLoop = setInterval(pointerRun, 50);

} // End of the function

function pointerRun()

{

if (pst == 3)

{

preRoll(3);

}

else if (pst == 4)

{

preRoll(4);

}

else

{

pointer_mc._rotation = pointer_mc._rotation + getRollSpd();

checkFinish();

} // end if

} // End of the function

function preRoll(time)

{

if (time == 3)

{

if (preRollFlag 60)

{

pointer_mc._rotation = pointer_mc._rotation + getRollSpd();

checkFinish();

}

else

{

pointer_mc._rotation = pointer_mc._rotation + 36;

preRollFlag++;

} // end if

}

else if (time == 4)

{

if (preRollFlag 80)

{

pointer_mc._rotation = pointer_mc._rotation + getRollSpd();

checkFinish();

}

else

{

pointer_mc._rotation = pointer_mc._rotation + 45;

preRollFlag++;

} // end if

} // end if

} // End of the function

function getRollSpd()

{

if (bingoPos != -1)

{

return(getBingoPos());

}

else

{

return(aoo);

} // end if

} // End of the function

function getBingoPos()

{

if (allRot 0 !hasCalc)

{

var _l1 = pointer_mc._rotation = 0 ? (pointer_mc._rotation) : (360 + pointer_mc._rotation);

allRot = 360 - _l1 + bingoPos * 22.500000;

if (allRot 360 pst 3)

{

allRot = allRot - 360;

} // end if

hasCalc = true;

} // end if

if (aoo 2)

{

aoo = aoo - pst / 2;

}

else

{

aoo = 2;

} // end if

allRot = allRot - aoo;

if (allRot 0)

{

return(aoo);

}

else

{

return(0);

} // end if

} // End of the function

function loadBingoPos()

{

var _l1;

flash.external.ExternalInterface.call("getUsrName");

if (usrName)

{

_l1 = "" + new Date() + "recomusername=" + usrName;

}

else

{

_l1 = "" + new Date() + "recomusername=";

} // end if

my_var.load(_l1);

} // End of the function

function checkFinish()

{

finishLoop = setInterval(ifFinish, 500);

} // End of the function

function ifFinish()

{

if (allRot = 0)

{

clearInterval(finishLoop);

succCallback();

}

else

{

finishVar++;

} // end if

} // End of the function

function succCallback()

{

flash.external.ExternalInterface.call("showAward", bingoPos);

} // End of the function

stop();

var spdLoop;

var pointerLoop;

var spdSpeed = 2;

var pst;

var isPress = false;

var bingoPos = -1;

var allRot = -1;

var aoo;

var hasCalc = false;

var my_var = new LoadVars();

var finishLoop;

var finishVar = 0;

var usrName;

var preRollFlag = 0;

my_var.onLoad = function (success)

{

if (success)

{

var _l2 = unescape(this).split("=")[0];

if (_l2 -1)

{

bingoPos = _l2;

rollRun(trans(cell_mc.speed_mc._currentframe));

}

else

{

isPress = false;

flash.external.ExternalInterface.call("getStart", _l2);

} // end if

}

else

{

trace("Error loading/parsing LoadVars.");

} // end if

};

start_btn.onPress = function ()

{

if (isPress == false)

{

getCellStart();

} // end if

};

start_btn.onRelease = function ()

{

if (isPress == false)

{

getCellStop();

isPress = true;

} // end if

};

怎么查看一款软件中flash游戏的代码?

如果是.swf后缀的文件,就可以用闪客精灵破解。首先下载并安装闪客精灵,运行,然后在左边的“文件浏览”里找到.swf的文件,点击,则中间出现影片的画面。在右边的“导出...”下能看到文件名,单击前面的+号,软件会自动分析SWF文件,然后出现很多个文件夹,找到“动作”文件夹,里面应该就是你要找的FLASH代码了。希望能够帮到你。