A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: why wont ball stop?

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    29

    why wont ball stop?

    for some reason the ball wont stop at the bottem of the frame, and start the direct 1 loop agian...
    -------------------------------------

    onClipEvent (load) {
    BallSpeed = 10;
    Friction = .85;
    Acc = 1.25;
    radius = this._height/2;
    direct = 1;
    bottem = 400;
    }

    onClipEvent (enterFrame){
    if (direct == 1) {
    this._y -= BallSpeed;
    BallSpeed *= Friction;
    if (BallSpeed <= .5) {
    direct = 2;
    }
    }
    else if (direct == 2) {
    this._y += BallSpeed;
    BallSpeed *= Acc;
    if (BallSpeed >= 10) {
    BallSpeed = 10
    }
    else if (this._y + radius == bottem){
    direct = 1;
    BallSpeed = 20;}

    }
    }

  2. #2
    :
    Join Date
    Dec 2002
    Posts
    3,518

    Maybe try something like this...

    Code:
    onClipEvent (load) {
    	BallSpeed = 10;
    	Friction = .85;
    	Acc = 1.25;
    	radius = this._height / 2;
    	direct = 1;
    	bottem = 400;
    }
    onClipEvent (enterFrame) {
    	if (direct == 1) {
    		this._y -= BallSpeed;
    		BallSpeed *= Friction;
    		if (BallSpeed <= .5) {
    			direct = 2;
    		}
    	} else if (direct == 2) {
    		this._y += BallSpeed;
    		BallSpeed *= Acc;
    		if (BallSpeed >= 10) {
    			BallSpeed = 10;
    		}
    		if (this._y + radius >= bottem) {
    			direct = 1;
    			BallSpeed = 20;
    		}
    	}
    }

  3. #3
    Junior Member
    Join Date
    May 2002
    Posts
    29
    wow i feel dumb O_o...

    thanks that worked

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center