タグ :

ランダム運動2-1 : ActionScript

投稿日 : 2008年2月24日 | 更新日 : 2010年09月15日 前のページへ戻る

ActionScriptでランダムにボールが落下するサンプルを作成しました。
function ParticleClip(target) {

	var target = target;

	this.execMotion = function(x, n) {
		for (var i = 0; i<n; i++);
			var container = target.createEmptyMovieClip("container"+i, i);
			var ball = container.attachMovie("ball", "ball", 0);
			container._x = Math.random()*300;
			container._rotation = Math.random()*2;
			container._y = 0;
			ball.onEnterFrame = function() {
				// Move the particle over time
				this._y += this.speed;
				this.speed++;
				if (this._y>300) {
					this._y = 0;
					this.speed = Math.random()*10+5;
					this._yscale = 100;
				}
			};
			ball.speed = Math.random()*10;
		}
	};
}

var obj = new ParticleClip(_root);
obj.execMotion(0, 100);
»ランダム運動3 : ActionScript »ランダム運動2-2 : ActionScript »ランダム運動2-1 : ActionScript »ランダム運動1 : ActionScript

ActionScript2.0 | 固定リンク | Comments (0)

関連記事

このページの上へ移動

コメント

コメントはまだありません。

現在、コメントフォームは閉鎖中です。

トラックバックURL

http://www.findxfine.com/flash/actionscript/127.html/trackback

このページの上へ