Menu Content/Inhalt
Home arrow Forum arrow Generalarrow Small Talkarrow Need Action Script Help.

May 22, 2008, 08:52:37 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Overview   Help Search Login Register  
Pages: [1]
  Send this topic  |  Print  
Author Topic: Need Action Script Help.  (Read 171 times)
ewm90
Good old dyslexic
Donator
*
Offline Offline

Posts: 5313


Topic starter

WWW
« on: November 22, 2006, 03:13:35 AM »

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 =
Code:
speedy + gravity;
to
Code:
speedy - gravity;
it gos flaying off the stage and wont retern the same problom hapinds when I chage
Code:
gravity = 2;
to
Code:
gravity < 2;
same problom... How do I redefine the Y axes so both objects will meet?

Code:
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;
}
}
}
« Last Edit: November 22, 2006, 03:18:37 AM by ewm90 » Logged

Ask me what Landmark education can do for you.
Landmark Education: Seminars, Courses & Landmark Forum
Pages: [1]
  Send this topic  |  Print  
 
Jump to:  

© 2003-2008 DOCa Cola. All rights reserved.
Star Trek and related marks are trademarks of Paramount Pictures.
Powered by Joomla
Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com