-
Hi, I am trying to have an object float around in a random motion, with a reflection.
I found the randome movement code somewhere, and tried making it work with the reflection. It works on the x, but not y ... it makes the reflection keep rising and rising untill it goes behind the object.
Please tell me what im doing wrong, TIA
onClipEvent (load) {
width = 5
height = 5
accelFactor = Math.ceil(Math.random()*4) + 2;
newX = Math.round(Math.random()*width);
newY = Math.round(Math.random()*height);
}
onClipEvent (enterFrame) {
currentlocx = this._x;
currentlocy = this._y;
differencex = newX-currentlocx;
differencey = newY-currentlocy;
accelx = differencex/accelFactor;
accely = differencey/accelFactor;
this._x = this._x+accelx;
this._y = this._y+accely;
_parent.reflect._x = _parent.reflect._x+accelx;
_parent.reflect._y = _parent.reflect._y-accely;
if (Math.round(this._y) == Math.round(newY) && Math.round(this._x) == Math.round(newX)) {
newX = Math.round(Math.random()*width);
newY = Math.round(Math.random()*height);
accelFactor = Math.ceil(Math.random()*4) + 2;
}
}
-
-
Hey -
this line:
_parent.reflect._y-accely;
should be
_parent.reflect._y+accely;
Psx
-
Product Designer
Actually, why don't you send me da file, I'll fixe it in 1 sec. but I need to see how the clips are placed..
webmaster@key-one.it
-
psycholonex .... if i change the - to a + .. then it will move in the same exact motion as the main object.. i need the reflection to have oposite motion in the y axis
Keyone.i... thanks, ill email it
-
Product Designer
I actually hope I did what you wanted...I suddenly thought I haven't....just tell me if it's like that
-
Product Designer
...so I get it I have to reflect the bottle on the floor right?
-
-
Product Designer
..looks like it's working to me, what are you exactly asking me to do? (it actually moves fine, if you take it's _alpha off you can see it "reflecting" the bottle correctly..)
-
Product Designer
I GOT IT....ok, now I understand! hehehehehehe
should have told me it takes a LONG time to go up...
this is probably a rounding problem, I'll check this out.
-
thought i mentioned the fact that it takes a while
-
Product Designer
-
ok... did you send the file back?... i didn't receive anything yet
-
Product Designer
I'm sorry...I can be so stupid sometimes.....(by the way, my email is not working now....f______g italian providers...they are really bad.)
http://pasodesign.com/extra/reflect.fla
cheers!
-
If you cant fix it... just go around it.... thanks!
-
Product Designer
-
yes, the way you did it is ok.
I originally was planing to use the image for the reflection, but because the original picture is taken at an angle that it is, if I flip it, it doesn't look right. So im debating if I should try to play with the image in photoshop and use that 2nd image as a reflection, or I should leave it in vector for the filesize sake.
-
Product Designer
best thing is you get a second shot of the image....filesize is going to stay low anyway....those photos are really small
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|