12 March 2010 [Friday] @ March 12, 2010 edit
Please Help, How to load a movie clip?
I'm not sure how to ask what I need to do, so I hope this is right. I have a bird that is flying around randomly. If its going forward everything is fine, but if it goes backwards, I'd like to load an image of it in reverse so that it actually looks like its flying in the opposite direction, not flying backwards. But i'm not quite sure how do that. Any help is greatly appreciated. Here is the code I have now to move the bird:
onClipEvent (load) {
//data you may want to change
width = 640;
height = 480;
speed = Math.round(Math.random()*2)+1;
//initial positions
x = this._x=Math.random()*width;
y = this._y=Math.random()*height;
x_new = Math.random()*width;
y_new = Math.random()*height;
}
onClipEvent (enterFrame) {
//x movement
if (x_new>this._x) {
sign_x = 1;
} else {
sign_x = -1;
_rotation = Math.atan2(this.yspeed, this.xspeed)*180/Math.PI;
}
dx = Math.abs(x_new-this._x);
if ((dx>speed) (dx<-speed)) {
this._x += sign_x*speed;
} else {
x_new = Math.random()*width;
}
//y movement
if (y_new>this._y) {
sign_y = 1;
} else {
sign_y = -1;
}
dy = Math.abs(y_new-this._y);
if ((dy>speed) (dy<-speed)) {
this._y += sign_y*speed;
} else {
y_new = Math.random()*height;
}
}
Thanks for any help you might can give me.I think it might be more beneficial if u upload your fla, bit confused about your code atm.Id just put 2 frames in your movieClip, 1 of what u want the bird to look like goin forward, and in the second, what it looks like goin backward. Then just put a stop action on the first frame of the movie clip and in your script tell it to go to frame 2 when its goin backwards and frame 1 when its goin forward.Sorry to be so confusing, here is a link to a zip version of my fla file and some of the pictures used in the background and stuff. It said the fla file was to big to upload here, www.paradocksgrille.com/flashsite.zip (http://www.paradocksgrille.com/flashsite.zip)I forgot to tell you that I have a scrolling background, and when I put frames in somewhere it messes up the background. Perhaps you could explain a little more or give a code example, I would appreciate it.
Thanks again.#If you have any other info about this subject , Please add it free.# |
|