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

📄 tool1.as

📁 小鱼历险记游戏
💻 AS
字号:
import game.phys.Particle;
import mx.utils.Delegate;
//补充_life点生命
class game.tool.Tool1 extends game.tool.Tool {
	private var _life=10
	function Tool1() {
		_id = "tool1";
		_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(50)+80;
			t._endx = random(550);
			t._endy = random(50);
			t.play();
		}
		function setEvent() {
			if (_hero.hitTest(obj)) {
				//吃食物的声音
				var my_sound:Sound = new Sound();
				my_sound.attachSound("eat");
				my_sound.start();
				//加上相应的生命
				_heroIns.setLife(_life);
				createScore("score_1", obj, "+", _life);
				obj.removeMovieClip();
				create();
			}
			if (obj._y<60) {
				obj.removeMovieClip();
				create();
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -