PDA

View Full Version : falling chickens! (gravity Code Needed)



Ravmaster
February 4th, 2006, 06:57 AM
hey im back after a long time sorry about that :cross-eye
but right now i need a code that these chickens are falling from the sky and the player is gonna click on them and then they will fly away... is there a code for this ;)

NiñoScript
February 4th, 2006, 07:17 AM
something like this?


var gravity:Number = .5;
chicken.speed = -5;
chicken.onEnterFrame = function () {
this.speed += gravity;
this._x += this.speed;
}
chicken.onPress = function () {
this.onEnterFrame = null;
this.gotoAndPlay("flyAway");
}

Ravmaster
February 4th, 2006, 08:44 AM
yes yes thnx a lot thts wht i need ;)

nathan99
February 4th, 2006, 06:05 PM
or


var gravity:Number = .5;
chicken.speed = -5;
chicken.onEnterFrame = function () {
this._x += (this.speed += gravity);
}
chicken.onPress = function () {
this.onEnterFrame = null;
this.gotoAndPlay("flyAway");
}

tho theyre the same