Home > Back-end >  Circulation problems
Circulation problems

Time:10-03

Public void the run () {
For (;; ) {

System. The out. Println (" 2 haojicheyijingguiwei ");
If (live& & X>=0 & amp; & x<790 & amp; & Y>=0 & amp; & Y<590) {
//generated random moving direction
Int direction=(int) (Math. The random () * 4);
//steps generate random moving
Int...=(int) (Math. The random () * 19);
//move on the x axis
While (direction==2)
{jl. SetIcon (icon5);
X=jl. GetX () - feet - 5; break; }
While (direction==0)
{jl. SetIcon (icon7);
X=jl. GetX () +... + 5; break; }

//on the y axis move
While (direction==1)
{jl. SetIcon (icon6);
Y=jl. GetY () +... + 5; break; }
While (direction==3)
{jl. SetIcon (icon8);
Y=jl. GetY () - feet - 5; break; }

Jl. SetBounds (x, y, 75,75);
Try {darktanke. Sleep (1000); }
Catch InterruptedException (e) {e.p rintStackTrace (); }
}
The else {jl. SetBounds (300300,75,75); break; }

}
}
}
After starting a thread, when the tanks moved to 300300. No longer perform the if the loop body

CodePudding user response:

Thank you, I suddenly found that a very wisdom.
X, y not change

CodePudding user response:

You this format code, so don't friendly, who would like to see
  • Related