?? tool3.as
字號:
?import game.phys.Particle;
import mx.utils.Delegate;
//加快主角的速度
class game.tool.Tool3 extends game.tool.Tool {
private var _speed = 1
private var _temp = 0;
private var _timeid:Number;
private var _time = 0;
function Tool3() {
_id = "tool3";
_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._endx = random(950)-400;
t._endy = random(50);
t.play();
}
function setEvent() {
if (_hero.fish.hitTest(obj)) {
//加上相應的速度
_heroIns._speed = _speed;
//_heroIns.move();
//如果已經得到,首先清除,否則會出現連續變化效果
clearInterval(_timeid);
_timeid = setInterval(this, "setTime", 1000);
_hero.bar._visible = true;
_hero.bar._xscale = 100;
_time = 0;
createScore("score_0", obj, "+", _speed);
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._speed = 2;
//_heroIns.move();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -