s

부드러운 움직임 2

· 2008-03-28 (금) 10:19:06 · 3275

//관성력
MovieClip.prototype.inertiaMove = function(widthX,heightY,g,fric){
        if(this._x + this.speedX > widthX - this._width/2){
                this.speedX = -1*this.speedX;
                this._x = widthX - this._width/2;
        }else if(this._x + speedX <0 + this._width/2){
                this.speedX = -1*this.speedX;
                this._x = 0 + this._width/2;
        }else{
                this._x += this.speedX ;
        }
        if(this._y + this.speedY > heightY - this._height/2){
                this.speedY = -1*this.speedY;
                this._y = heightY - this._height/2;
        }else if(this._y + this.speedY <0 + this._height/2){
                this.speedY = -1*this.speedY;
                this._y = 0 + this._height/2;
        }else{
                this._y += this.speedY;
        }
       
        this.speedY = this.speedY + g;
        this.speedX = fric*this.speedX;
        this.speedY = fric*this.speedY;
};

//포물선운동
MovieClip.prototype.parabolaMove = function(){
        this.vy = this.vy + this.g;
        this._x = this._x + this.vx;
        this._y = this._y + this.vy;
};

[이 게시물은 관리자님에 의해 2011-10-31 16:50:06 Flash에서 이동 됨]
|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
MySQL 08-03-25 조회 4,512
MySQL 08-03-25 조회 4,441
MySQL 08-03-25 조회 4,182
MySQL 08-03-25 조회 4,054
기타 08-03-25 조회 2,755
MySQL 08-03-25 조회 4,055
MySQL 08-03-25 조회 5,213
기타 08-03-21 조회 3,156
Flash 08-03-14 조회 3,445
기타 08-03-13 조회 4,146
JavaScript 08-03-11 조회 3,429
기타 08-03-11 조회 2,730
JavaScript 08-03-11 조회 2,558
JavaScript 08-03-11 조회 2,294
Flash 08-03-08 조회 2,882
JavaScript 08-03-07 조회 4,229
JavaScript
[JavaScript]
08-03-07 조회 3,228
기타
[기타]
08-03-06 조회 3,196
Flash 08-03-06 조회 3,338
JavaScript 08-03-06 조회 4,810
JavaScript 08-03-04 조회 3,695
Flash 08-03-03 조회 4,846
기타 08-02-28 조회 3,565
jQuery 08-02-22 조회 6,935
기타 08-02-22 조회 3,322
jQuery 08-02-21 조회 5,115
기타 08-02-21 조회 4,862
jQuery 08-02-21 조회 8,615
Flash 08-02-20 조회 3,441
PHP 08-02-19 조회 4,317