I am trying to get a refletion efect with action srcipt. I have one object that falls to one pont on the stage as it should but when I chage speedy =
speedy + gravity;
to
speedy - gravity;
it gos flaying off the stage and wont retern the same problom hapinds when I chage
gravity = 2;
to
gravity < 2;
same problom... How do I redefine the Y axes so both objects will meet?
onClipEvent (load) {
// gravity is what I called g in the tutorial. The
// higher g the harder the ball will fall.
// gravity = 0 can be set, as an experiment, but
// it will in fact create a "zero gravity" effect
// gravity < 0 will create an inverted gravity effect
gravity = 2;
// This sets the _y position of the floor
floor = -320;
floorx1 = 0;
floorx2 = -90;
// Bounce is a number < 1 but close to 1
// The closer to 1, the higher the ball will bounce
bounce = 0.92;
// We set the speed of the ball when it is released.
speedx = 0;
speedy = 0;
}
onClipEvent (enterFrame) {
if (pressing) {
// if we are pressing
// drag the object
startDrag (this,true);
// calculate the speed
speedx = this._x - x3;
speedy = this._y - y1;
// set a new reference point
x4 = this._x;
y7 = this._y;
} else {
stopDrag ();
speedy = speedy + gravity;
this._x += speedx/5;
this._y += speedy/5;
if (this._y > floor) {
this._y = floor;
speedy *= -bounce;
}
if (this._x < floorx1) {
this._x = floorx1;
speedx *= -bounce;
}
if (this._x > floorx2) {
this._x = floorx2;
speedx *= -bounce;
}
}
}