我正在创建类似http://www.puzzlegames.org/814games-Connect-2-Game-game.html的游戏。那么我应该在connected()功能中添加什么?
fB并且sB选择了第一个和第二个按钮。
fBN并且sBN是这些按钮的名称。
allNull()使fB, sB, fBN, 为sBN空。
function onClick(e:MouseEvent):void {
if (! another) {
another = true;
fB = e.target;
fBN = e.target.name;
}
else {
sB = e.target;
sBN = e.target.name;
if (fBN == sBN)
{
allNull();
}
else if (connected())
{
fB.removeEventListener(MouseEvent.MOUSE_DOWN, onClick);
sB.removeEventListener(MouseEvent.MOUSE_DOWN, onClick);
fB.alpha = 0;
sB.alpha = 0;
pairCount++;
allNull();
if (pairCount == 25)
{
gameOver = false;
showScore();
endGame();
}
}
another = false;
}
}
请帮忙。自 15 天以来,我一直在尝试解决此问题。提前致谢。