Stuff
public text v1 · immutableclass Movement extends Thread{
EnemyShip es;
public Movement(EnemyShip ref){
es=ref;
}
public void run(){
while(true){
if(es.r==1){
es.setLocation(es.getX()+2,es.getY());
}
else{
es.setLocation(es.getX()-2,es.getY());
}
try{
sleep(es.speed);
}
catch(Exception e){
}
if(es.getX()<0 || es.getX()>640){
System.out.println("Reached other side");
es.setLocation(-150,-150);
try{
wait();
}
catch(Exception e){
System.out.println("can't wait");
}
}
}
}