PDA

View Full Version : Need some help(newbie)



beertents
August 20th, 2003, 10:01 PM
I have a clip of a bird flying across the screen. I found a script on the web that would give me random starts across the screen. but it seems not to work that well. Is there a simple script that can acheive the effect of the bird flying randomly across the screen?
Any help would be greatly appreciated. TIA:D

claudio
August 20th, 2003, 10:27 PM
Place the following code on the movie clip:onClipEvent (load) {
initx = 0-_width;
stagex = 550;
stagey = 400;
speed = Math.random()*2+1;
_x = initx;
}
onClipEvent (enterFrame) {
if (_x>stagex) {
_x = initx;
_y = Math.random()*stagey;
speed = Math.random()*2+1;
} else {
_x += speed;
}
}I suggest a frame rate of 25.

beertents
August 20th, 2003, 11:11 PM
Thanx for the script it is much better as i used to have a tween of the bird flying across and now this seems much nicer. Just one hopefully minor detail. I need the bird to stay at the top half of the page. Is this at all possible. Much appreciated claudio!!

claudio
August 20th, 2003, 11:13 PM
As you wish.. ;)onClipEvent (load) {
initx = 0-_width;
inity = Math.random()*200;
stagex = 550;
stagey = 200;
speed = Math.random()*2+1;
_x = initx;
_y = inity;
}
onClipEvent (enterFrame) {
if (_x>stagex) {
_x = initx;
_y = Math.random()*stagey;
speed = Math.random()*2+1;
} else {
_x += speed;
}
}

beertents
August 20th, 2003, 11:42 PM
Your help is greatly appreciated but that didnt seem to work.
Umm. I have some great ideas but cant seem to get the hang of the scripts. I notice 1 change from the previous script.

claudio
August 20th, 2003, 11:49 PM
That do works :-\

beertents
August 20th, 2003, 11:54 PM
Yes sorry you are right!!! I wasnt clear, my movie is only 550X300. I changed the code to reflect the difference in my movie and it works very well now!!! Thank You!!! Thank You!!

claudio
August 20th, 2003, 11:56 PM
Ahh i knew
Anytime =)