Hi all,
I’m currently trying to get a movieclip of mine to randomly pick a target x location, go to that location, and once it is there I need it to pick another location, rinse, repeat. My current code works for the first location (called targetx) but once it gets there it vibrates back and forth. I must be missing something…
onClipEvent(load){
var speed = 5;
this._y = 120;
this._x = 250;
var targetx = 250;
}
onClipEvent(enterFrame){
if (this._x > targetx){
this._x -= speed;
}else if (this._x < targetx){
this._x -= -speed;
}else if (this._x == targetx){
targetx = Math.random(1)*500;
}
}
Thanks in advance!