Hi,
I’m trying to acheive the effect of some bombs falling randomly down the screen. They start at different heights and have different floor values, however the gravity value remains the same. My problem is that one of the bombs adhears to the floor value but using the EXACT same code for the others doesn’t seem to work and they continue falling off the stage well beyond the floor value and then bounce back up.
This is the code I have used for each one:
onClipEvent (load) {
gravity = 2 ;
floor = 150 ;
bounce = 0.80 ;
speedx = 0 ;
speedy = 0 ;
}
onClipEvent (enterFrame) {
speedy = speedy + gravity ;
this._x += speedx/5 ;
this._y += speedy/5 ;
if (this._y > floor) {
this._y = floor ;
speedy *= -bounce ;
}
}
I have altered nothing bar the floor value for each bomb. Does anyone know this as a common problem? Is athere a value specific to each movie clip that I havn’t altered?
Cheers,
Brent