import java.awt.*; public class ship extends Object { String currentstate="Waiting"; Image myimage=null; Image myblankimage=null; int myid=-1; int posx=0; int posy=0; ship(Image i,Image b,int id) { myimage=i; myblankimage=b; myid=id; } public void move(Graphics g,prodcon prnt) { // delete the old ship and paint the new one if ((currentstate.equals("Producing")) || (currentstate.equals("Consuming"))) { g.drawImage(myblankimage,posx,posy,prnt); } if (currentstate.equals("Producing")) { // move from upper right to my position if ((posx==0) && (posy==0)) { // starting position posx=250; posy=50; } else { posx=posx-10; posy=posy+(10*myid); } g.drawImage(myimage,posx,posy,prnt); } else if (currentstate.equals("Consuming")) { // move from mypos to lower right posx=posx+10; posy=posy+(10*(3-myid)); g.drawImage(myimage,posx,posy,prnt); } } }