English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

ok...say I have dot1(enemy) and I want it to approach the position of dot2(shield)....how do I do that? I can make dot1(enemy) move to the starting location of dot2(shield)...but if dot 2(shield) moves dot1(enemy) does not travel to the new position... how do I retrieve the new location? this is what I have been using: ( it is inside of of the dot1(enemy) movie clip):


onClipEvent(enterFrame){
eSpeed = 2;
if(this._x > _root.shield._x){
_x -= eSpeed;
}
if(this._x < _root.shield._x){
_x += eSpeed;
}
if(this._y > _root.shield._y){
_y -= eSpeed;
}
if(this._y < _root.shield._y){
_y += eSpeed;
}
}

2006-06-30 08:16:46 · 1 answers · asked by strangenate@sbcglobal.net 1 in Computers & Internet Programming & Design

1 answers

Your first and second if and your third and fourth if are all tested. There is nothing that stops the testing of the second and fourth if after a true result of the first and third if.

You need to add an else to the first and second if and an else to the third and fourth.

2006-06-30 23:30:00 · answer #1 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers