⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tool3.as

📁 小鱼历险记游戏
💻 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._time = random(60)+80
			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 + -