창고 속의 창고

[스크랩] 물방울 세이프

심춘 2007. 6. 14. 20:47

먼저 물방울(여러 효과)을 만드신후
'name'를 'blob0'으로 하신후 'target'에 체크해주신후
액션을 주세요. (sprite화 하지마세요)
----------------------
onEnterFrame() {
move();
}
-----------------
아 위치는 오른쪽 배경 사이즈 바깥 밑에 두세요.

이제 ' 신'에다 액션만 주시면 된답니다.
------------
xxonLoad () {
movieclip.prototype.move = move;
movieclip.prototype.reset = reset;
for (n=1; n<=20; n++) {
blob0.duplicateSprite("blob" add n,n);
}
}
function getdistance(x,y,x1,y1) {
run = x1 - x;
rise = y1 - y;
return (_root.hyp(run, rise));
}
function hyp(a,b) {
return (Math.sqrt((a * a) + (b * b)));
}
function reset() {
width = 620;
height = 450;
this.x = this._x;
this.y = this._y;
this.speed = (Math.random() * 4) + 2;
this.targx = Math.random() * width;
this.targy = Math.random() * height;
dist = _root.getdistance(this.x, this.y, this.targx, this.targy);
norm = this.speed / dist;
this.diffx = (this.targx - this.x) * norm;
this.diffy = (this.targy - this.y) * norm;
}
function move() {
if (this.speed < _root.getdistance(this.x, this.y, this.targx, this.targy)) {
this.x = this.x + this.diffx;
this.y = this.y + this.diffy;
} else {
this.x = this.targx;
this.y = this.targy;
if (!this.t) {
this.t = getTimer();
}
if (1000 < (getTimer() - this.t)) {
this.reset();
this.t = 0;
}
}
this._x = this.x;
this._y = this.y;
}
-------------------------
수자로 된곳만 알아서 수정 해보세요~~
그리고 파도처럼 흔들리는 효과는
네모툴로 모양을 두개 만들어준후 그룹후
Rippling Water
이 효과만 준거랍니다. sprit'해주구..

※물방울 아닌 여러 효과로도 응용해보세요~~
 
   

 

출처 : swish max 자료실
글쓴이 : 나그네 원글보기
메모 :