예제 #1
0
 public void run() {
   while (true) {
     if (!isFirst) {
       room.physic();
     }
     repaint();
     try {
       Thread.sleep(1);
     } catch (Exception e) {
     }
   }
 }
예제 #2
0
 public void paintComponent(Graphics g) { // display
   if (isFirst) {
     myWidth = getWidth();
     myHeight = getHeight();
     define();
     isFirst = false;
   }
   g.clearRect(0, 0, getWidth(), getHeight());
   room.draw(g); // draw map
   store.draw(g); // draw sidebar
   // b.draw(g);
   theMinion.draw(g);
   if (to != null) { // tower selected movement
     to.draw(g, xval, yval, to);
   }
   for (Tower i : tplace) {
     i.draw(g, i);
   }
 }