예제 #1
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (scene == OVERWORLD) g.drawImage(background, 0, 0, this);
   if (scene == BATTLE) {
     if (battleBG == 1) g.drawImage(background, 0, -130, this);
     else g.drawImage(background, 0, 0, this);
   }
   int loop;
   for (loop = 0; loop < enemies.size(); loop++) {
     if (scene == OVERWORLD) {
       enemies.get(loop).drawEnemy(g);
     }
     if (scene == BATTLE) {
       if (enemies.get(loop).getActivity()) {
         enemies.get(loop).drawEnemy(g);
       }
     }
   }
   for (loop = 0; loop < spellsThrown.size(); loop++) {
     spellsThrown.get(loop).drawSpell(g);
   }
   player.drawPlayer(g);
   for (loop = 0; loop < enemies.size(); loop++) {
     enemies.get(loop).drawSpells(g);
   }
   if (scene == BATTLE) {
     drawMenu(g);
     if (battleWon) drawVictory(g);
     else if (battleLost) drawDefeat(g);
   }
 }
 // paints the player, items, and rooms
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   Environment Layout = new Environment();
   Layout.drawRoom(mapX, mapY, g);
   Player PlayerSprite = new Player();
   PlayerSprite.drawPlayer(x, y, g);
   Layout.items(x, y, g, getItem);
 }