📄 tool4.as
字号:
import game.phys.Particle;
import mx.utils.Delegate;
//让主角隐身
class game.tool.Tool4 extends game.tool.Tool {
private var _temp = 0;
private var _timeid:Number;
private var _time = 0;
function Tool4() {
_id = "tool4";
_total = 1;
}
private function move(obj) {
var t:Particle = new Particle();
t._target = obj;
t.addEventListener("onStop", Delegate.create(this, init));
t.addEventListener("onPlay", Delegate.create(this, setEvent));
init();
//重新移动
function init() {
t._time = random(60)+80;
t._endx = random(950)-400;
t._endy = random(50);
t.play();
}
function setEvent() {
if (_hero.fish.hitTest(obj)) {
//隐身
_heroIns._hide = false;
_hero._alpha = 20;
//如果已经得到,首先清除,否则会出现连续变化效果
clearInterval(_timeid);
_timeid = setInterval(this, "setTime", 1000);
_hero.bar._visible = true;
_hero.bar._xscale = 100;
_time = 0;
createScore("score_0", obj, "+", _heroIns._hide);
obj.removeMovieClip();
create();
}
if (obj._y<60) {
obj.removeMovieClip();
create();
}
}
}
function setTime() {
_time++;
_hero.bar._xscale = 100-_time*10;
if (_time>=10) {
_hero.bar._visible = false;
clearInterval(_timeid);
//恢复原来的状态
_heroIns._hide = true;
_hero._alpha = 100;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -