S4K
07-24-2006, 11:36 AM
onClipEvent (enterFrame) {
function increase(a:Number):Number {
if (a>-10) {
return a-2;
} else if (a<-10) {
return a=-10;
}
}
if (Key.isDown(Key.LEFT)) {
var speed:Number = -4;
var increasedSpeed:Number = increase(speed);
this._x = this._x+increasedSpeed;
wheel1_mc._rotation -= 10;
wheel2_mc._rotation -= 10;
trace(increasedSpeed);
}
hey people, i need some help around here what i want to do is creating a car_mc and the car's speed increase:
the code i posted passes the speed from 0 to 6 and what i want is 0,1,2,3,4,5,6,7,8,9,10 and stay on 10 while we press the key...
in the code above i use a function but it's not looping i think :mad:
help me
Many thanks, s4k
function increase(a:Number):Number {
if (a>-10) {
return a-2;
} else if (a<-10) {
return a=-10;
}
}
if (Key.isDown(Key.LEFT)) {
var speed:Number = -4;
var increasedSpeed:Number = increase(speed);
this._x = this._x+increasedSpeed;
wheel1_mc._rotation -= 10;
wheel2_mc._rotation -= 10;
trace(increasedSpeed);
}
hey people, i need some help around here what i want to do is creating a car_mc and the car's speed increase:
the code i posted passes the speed from 0 to 6 and what i want is 0,1,2,3,4,5,6,7,8,9,10 and stay on 10 while we press the key...
in the code above i use a function but it's not looping i think :mad:
help me
Many thanks, s4k