I’m having a really hard learning experience. I’m trying to make a ball do a random “wave” across the stage like that one kirupa banner does.
This is the code I have so far.
onClipEvent (load){
width = 720;
height = 200;
this._x = -20;
this._y = Math.round(Math.random()*height);
origy = this._y
speed = Math.round(1+Math.random()*11);
up = true;
faster = Math.round(1+Math.random()*6);
slower = Math.round(5+Math.random()*6);
}
onClipEvent (enterFrame){
this._x+=speed;
if (speed<=5){
yend = origy+slower;
yup = slower;
}
if (speed>=6){
yend = origy+faster;
yup = faster;
}
if (this._y>yend+2){
up=false;
}
if (this._y<origy+2){
up=true;
}
if (up=true){
this._y+=yup/2
}
if (up=false){
this._y+=-yup/2
}
}
Right now it’ll choose a random y position and angle down at a speed depending on the speed var.
But I can’t get it to start going the other direction when it hits a certain point or over.
Thanx.
;(