【发布时间】:2014-02-26 15:39:00
【问题描述】:
好的,我有一些爱丽丝梦游仙境场景的脚本,她正在吃蛋糕和喝药水,让她变大变小。我已经能够链接两个按钮,这样当点击eat_me 时,她会变小,而当点击drink_me 时,她会变大。
我想要实现的是给 Alice 一个像 2 这样的数字,当你点击 eat_me 时它会下降 1,当你点击 drink_me 时它会上升 1。然后我希望 AS3 识别 Alice 何时处于 0然后移至下一帧。我有一些代码,但不太确定我是否接近。
var alice_size:Number = 2;
drink_me.addEventListener(MouseEvent.MOUSE_DOWN, resizeAlice);
function resizeAlice(event:MouseEvent):void {
sitting_alice.width = sitting_alice.width * 2;
sitting_alice.height = sitting_alice.height * 2;
{if (drink_me.hitTestObject(sitting_alice))
alice_size = alice_size +1;}
}
eat_me.addEventListener(MouseEvent.MOUSE_UP, resizeAlice2);
function resizeAlice2(event:MouseEvent):void {
sitting_alice.width = sitting_alice.width / 2;
sitting_alice.height = sitting_alice.height / 2;
{if (eat_me.hitTestObject(sitting_alice))
alice_size = alice_size -1;}
}
if (alice_size == 0){
gotoAndStop (405)
}
【问题讨论】:
-
ifs 前面为什么要加花括号?
标签: actionscript-3 flash function scaling next