示例#1
0
  public void newGame() {
    dissapear = false;

    botborder.clear();
    topborder.clear();

    missiles.clear();
    smoke.clear();

    minBorderHeight = 5;
    maxBorderHeight = 30;

    player.resetDY();
    player.resetScore();
    player.setY(HEIGHT / 2);

    if (player.getScore() > best) {
      best = player.getScore();
    }

    // create initial borders

    // initial top border
    for (int i = 0; i * 20 < WIDTH + 40; i++) {
      // first top border create
      if (i == 0) {
        topborder.add(
            new TopBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick), i * 20, 0, 10));
      } else {
        topborder.add(
            new TopBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                i * 20,
                0,
                topborder.get(i - 1).getHeight() + 1));
      }
    }
    // initial bottom border
    for (int i = 0; i * 20 < WIDTH + 40; i++) {
      // first border ever created
      if (i == 0) {
        botborder.add(
            new BotBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                i * 20,
                HEIGHT - minBorderHeight));
      }
      // adding borders until the initial screen is filed
      else {
        botborder.add(
            new BotBorder(
                BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                i * 20,
                botborder.get(i - 1).getY() - 1));
      }
    }

    newGameCreated = true;
  }
示例#2
0
  @Override
  /**
   * Play the game. Alternate between the two players and print the board's current state between
   * each move.
   */
  public GameResult play() {
    Player player1 = getPlayer1();
    Player player2 = getPlayer2();
    while (!gameOver()) {
      Player player = (getTurn() < 0) ? player1 : player2;
      boolean successfulMove = playTurn(player);
      if (!successfulMove) incrementPass();
      else resetPasses();
      player.resetParameters();
      setTurn(-getTurn());
      player.addScoreToHistory(player.getScore());
    }

    player1.removeLastScoreFromHistory();
    player2.removeLastScoreFromHistory();

    for (Character letter : player1.getTilesOnHand()) {
      player1.removePointsFromScore(Alphabet.getLetterPoint(letter));
    }
    for (Character letter : player2.getTilesOnHand()) {
      player2.removePointsFromScore(Alphabet.getLetterPoint(letter));
    }

    player1.addScoreToHistory(player1.getScore());
    player2.addScoreToHistory(player2.getScore());
    GameResult result = new GameResult(player1, player2, isPlayer1StartsPlaying());

    return result;
  }
示例#3
0
 private void hit(Player p) {
   Card drawn = drawCard();
   int value = drawn.getValue();
   String sval;
   if (value > 2 && value < 11) {
     sval = value + "";
   } else if (value == 11) {
     sval = "Jack";
     value = 10;
   } else if (value == 12) {
     sval = "Queen";
     value = 10;
   } else if (value == 13) {
     sval = "King";
     value = 10;
   } else {
     sval = "Ace";
     if (p.getScore() <= 10) {
       value = 11;
     }
   }
   p.add(value);
   String suit = drawn.getSuit();
   io.print(p.getName() + " drew the " + sval + " of " + suit + ".");
   io.print(p.getName() + "'s score is currently " + p.getScore());
 }
示例#4
0
 /**
  * Shows winner
  *
  * @return winner
  */
 public String winner() {
   if (getTurnsLeft() == 0) {
     if (a.getScore() > b.getScore()) return "Player one wins";
     else return "Player two wins";
   }
   return "Game not over yet";
 }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (savedInstanceState != null) {
      actTag = savedInstanceState.getString("TAG");
      player1 = savedInstanceState.getParcelable("playerOne");
      player2 = savedInstanceState.getParcelable("playerTwo");
      countOk = savedInstanceState.getInt("countOk");
    }

    mItems = new ArrayList<ListViewItem>();

    Resources resources = getResources();

    mItems.add(new ListViewItem("", player1.getName(), player2.getName()));
    mItems.add(
        new ListViewItem(
            "Score", String.valueOf(player1.getScore()), String.valueOf(player2.getScore())));
    mItems.add(
        new ListViewItem(
            "Sets", String.valueOf(player1.getSets()), String.valueOf(player2.getSets())));
    mItems.add(
        new ListViewItem(
            "Legs", String.valueOf(player1.getLegs()), String.valueOf(player2.getLegs())));
    mItems.add(
        new ListViewItem(
            "Darts", String.valueOf(player1.getDarts()), String.valueOf(player2.getDarts())));
    mItems.add(
        new ListViewItem(
            "Best leg",
            String.valueOf(String.format("%.2f", player1.getBestleg())),
            String.valueOf(String.format("%.2f", player2.getBestleg()))));
    mItems.add(
        new ListViewItem(
            "Previous leg",
            String.valueOf(String.format("%.2f", player1.getPreviousLeg())),
            String.valueOf(String.format("%.2f", player2.getPreviousLeg()))));
    mItems.add(
        new ListViewItem(
            "Current leg",
            String.valueOf(String.format("%.2f", player1.getCurrentLeg())),
            String.valueOf(String.format("%.2f", player2.getCurrentLeg()))));
    mItems.add(
        new ListViewItem(
            "Current set",
            String.valueOf(String.format("%.2f", player1.getCurrentSet())),
            String.valueOf(String.format("%.2f", player2.getCurrentSet()))));
    mItems.add(
        new ListViewItem(
            "Match",
            String.valueOf(String.format("%.2f", player1.getMatch())),
            String.valueOf(String.format("%.2f", player2.getMatch()))));

    setListAdapter(new ListViewAdapter(getActivity(), mItems));

    // remove the dividers from the ListView of the ListFragment
    getListView().setDivider(null);
  }
示例#6
0
 private void drawWinnerUI() {
   Graphics g = game.getGraphics();
   g.drawRect(0, 0, 1281, 801, Color.argb(pulse / 2, 138, 155, 15));
   paint.setTextSize(100);
   g.drawString("GAME OVER! ", 640, 300, paint);
   paint.setTextSize(50);
   g.drawString("YOU WON ", 640, 400, paint);
   g.drawString(player.getScore() + " - " + opponent.getScore(), 640, 500, paint);
 }
 @Test
 public void testGetScore_AfterScoreChange() {
   assertTrue(player1.getScore() == 0);
   assertTrue(player2.getScore() == 0);
   player1.setScore(100);
   player2.setScore(999);
   assertTrue(player1.getScore() == 100);
   assertTrue(player2.getScore() == 999);
 }
示例#8
0
 public void printConsole() {
   System.out.println(
       "Game:"
           + server.getName()
           + "="
           + server.getScore()
           + ";"
           + reciever.getName()
           + "="
           + reciever.getScore());
 }
示例#9
0
  /**
   * Parse incoming message.
   *
   * @param bytes byte array of received message
   * @param num number of bytes received
   */
  public void parse(byte[] bytes, int num) {
    String msg = new String(bytes);
    if (num > 0) {
      if (msg.charAt(0) == 'X' && state == GameState.Running) {
        Log.d("**TRON**", "receiving coords...");
        Scanner scanner = new Scanner(msg);
        int x = scanner.useDelimiter("[^\\d]+").nextInt();
        int y = scanner.useDelimiter("[^\\d]+").nextInt();
        grid.setOpponent(x, y);
        Log.d("**TRON**", "received coords: " + x + " " + y);
      }
      if (msg.startsWith("LOST")) {
        player.scored();
        if (player.getScore() >= goal) {
          ((TronGame) game).saveWin();
          state = GameState.Winner;
        } else {
          state = GameState.Win;
        }
      }

      if (msg.startsWith("WIN")) {
        if (state == GameState.Running) {
          connection.write("LOST".getBytes());
          opponent.scored();
          if (opponent.getScore() == goal) {
            ((TronGame) game).saveLose();
            state = GameState.Loser;
          } else {
            countdown = 300.0f;
            state = GameState.Lose;
          }
        }
      }

      if (msg.startsWith("READY")) {
        connection.write("START".getBytes());
        countdown = 300.0f;
        state = GameState.Ready;
        restart();
      }
      if (msg.startsWith("START")) {
        countdown = 300.0f;
        state = GameState.Ready;
        restart();
      }
      if (msg.startsWith("EXIT")) {
        countdown = 300.0f;
        state = GameState.Error;
        restart();
      }
    }
  }
示例#10
0
 private void doRoundResults() {
   if (plyr.isBust() && !dlr.isBust()) {
     io.print("The Player is bust, leaving the Dealer to win by default.");
   } else if (dlr.isBust() && !plyr.isBust()) {
     io.print("The Dealer is bust, leaving the Player to win by default.");
   } else if (dlr.getScore() > plyr.getScore()) {
     io.print("The Dealer wins.");
   } else if (plyr.getScore() > dlr.getScore()) {
     io.print("The Player wins.");
   } else {
     io.print("Game ends in a draw.");
   }
 }
示例#11
0
 private void doPlayerTurn() {
   String input = "";
   while (plyr.getScore() < 21 && !input.equalsIgnoreCase("stand")) {
     io.print("\nSelect your move.");
     while (!io.hasInput()) {
       try {
         Thread.sleep(500);
       } catch (InterruptedException e) {
         e.printStackTrace();
       }
     }
     input = io.getInput();
     switch (input) {
       case "hit":
         hit(plyr);
         if (plyr.isBust()) {
           io.print("Player is bust!");
           continue;
         }
         break;
       case "stand":
         continue;
     }
   }
 }
示例#12
0
 private int getPlayersMinScore() {
   int result = 0;
   for (Player player : players) {
     result = Math.min(player.getScore(), result);
   }
   return result;
 }
示例#13
0
  private void updateRunning(List<TouchEvent> touchEvents, float deltaTime) {

    timePassed += deltaTime;

    for (TouchEvent event : touchEvents) {
      if (event.type == TouchEvent.TOUCH_DOWN) {

        if (event.x < buttonWidth) {
          player.moveLeft();
        } else if (event.x > buttonWidth + game.getGraphics().getHeight()) {
          player.moveRight();
        }
      }
    }

    if (!player.isAlive) {
      connection.write("LOST".getBytes());
      opponent.scored();
      if (opponent.getScore() == goal) {
        ((TronGame) game).saveLose();
        state = GameState.Loser;
      } else {
        countdown = 300.0f;
        state = GameState.Lose;
      }
    } else if (timePassed > 10.0) {
      player.update();
      grid.update(player);
      timePassed -= 10.0f;
    }
  }
示例#14
0
 @Override
 public void showWord(String word, java.util.List<BoardCell> letterLocations, Player player) {
   myWordList.add(word);
   scoreText.setText(player.getScore() + "");
   scoreText.paintImmediately(scoreText.getVisibleRect());
   myWordList.paintImmediately(myWordList.getVisibleRect());
   wordEntryField.clear(); // clear the wordEntryField text
 }
示例#15
0
 private void doDealerTurn() {
   while (dlr.getScore() < 17) {
     hit(dlr);
     if (dlr.isBust()) {
       io.print("Dealer is bust!");
     }
   }
 }
示例#16
0
 /** funkcja dodająca wyniki do listy najlepszych */
 public static void addBest() {
   Record rec = new Record(Player.getPlayerName(), Player.getScore());
   if (best.size() < MAX) best.add(rec);
   else if (returnMin() < rec.getScore()) {
     best.remove(MAX - 1);
     best.add(rec);
   }
 }
示例#17
0
  @Override
  public void nextStepForAllGames() {
    lock.writeLock().lock();
    try {
      for (Game game : games) {
        if (game.isGameOver()) {
          game.newGame();
        }
        game.tick();
      }

      HashMap<Player, PlayerData> map = new HashMap<Player, PlayerData>();
      for (int i = 0; i < games.size(); i++) {
        Game game = games.get(i);

        Player player = players.get(i);

        map.put(
            player,
            new PlayerData(
                gameType.getBoardSize(),
                decoder.encode(game.getBoardAsString()),
                player.getScore(),
                game.getMaxScore(),
                game.getCurrentScore(),
                player.getCurrentLevel() + 1,
                player.getMessage()));
      }

      screenSender.sendUpdates(map);

      for (int index = 0; index < players.size(); index++) {
        Player player = players.get(index);
        Game game = games.get(index);
        try {
          String board = game.getBoardAsString().replace("\n", "");

          if (logger.isDebugEnabled()) {
            logger.debug(String.format("Sent for player '%s' board \n%s", player, board));
          }

          controllers.get(index).requestControl(player, board);
        } catch (IOException e) {
          logger.error(
              "Unable to send control request to player "
                  + player.getName()
                  + " URL: "
                  + player.getCallbackUrl(),
              e);
        }
      }
    } catch (Error e) {
      e.printStackTrace();
      logger.error("nextStepForAllGames throws", e);
    } finally {
      lock.writeLock().unlock();
    }
  }
 public String getPlayerInfo(Player player) {
   return (player.getPlayerID()
       + ";"
       + player.getScore()
       + ";"
       + player.getRacket().getPositionX()
       + ";"
       + player.getRacket().getPositionY());
 }
示例#19
0
  @Test
  public void shouldCountScores() {
    // given
    givenFl("☼   ☼" + "☼   ☼" + "☼ ☺ ☼" + "☼   ☼" + "☼   ☼");

    assertEquals(0, player.getScore());
    player.event(Events.DESTROY_BOMB);

    assertEquals(1, player.getScore());
    player.event(Events.DESTROY_STONE);
    player.event(Events.DESTROY_STONE);

    assertEquals(3, player.getScore());
    player.event(Events.DESTROY_ENEMY);

    assertEquals(4, player.getScore());
    player.event(Events.LOOSE);

    assertEquals(0, player.getScore());
    assertEquals(4, player.getMaxScore());
  }
示例#20
0
  public Object getValueAt(int row, int col) {
    Player p = players.get(row);

    if (col == 0) {
      return p;
    } else if (col == 1) {
      return String.valueOf(p.getScore());
    } else if (col == 2) {
      return String.valueOf(p.getKills());
    }

    assert false : "Too many columns.";
    return null;
  }
示例#21
0
  /**
   * Draw the HUD
   *
   * @param g the g
   */
  public void draw(Graphics2D g) {

    // Draw the number of lives the player has
    for (int i = 0; i < player.getLives(); i++) {
      g.drawImage(image, i * 30, 0, null);
    }

    g.setFont(font);
    g.setColor(Color.GREEN);
    g.drawString("1UP", 130, 26);
    g.setColor(Color.WHITE);
    g.drawString("" + player.getExtraLive(), 130, 54);
    g.setColor(Color.RED);
    g.drawString("HIGH SCORE", 325, 26);
    g.setColor(Color.WHITE);
    g.drawString("" + player.getScore(), 325, 54);
  }
示例#22
0
  public void updateTopBorder() {
    // every 50 points, insert randomly placed top blocks that break the pattern
    if (player.getScore() % 50 == 0) {
      topborder.add(
          new TopBorder(
              BitmapFactory.decodeResource(getResources(), R.drawable.brick),
              topborder.get(topborder.size() - 1).getX() + 20,
              0,
              (int) ((rand.nextDouble() * (maxBorderHeight)) + 1)));
    }
    for (int i = 0; i < topborder.size(); i++) {
      topborder.get(i).update();
      if (topborder.get(i).getX() < -20) {
        topborder.remove(i);
        // remove element of arraylist, replace it by adding a new one

        // calculate topdown which determines the direction the border is moving (up or down)
        if (topborder.get(topborder.size() - 1).getHeight() >= maxBorderHeight) {
          topDown = false;
        }
        if (topborder.get(topborder.size() - 1).getHeight() <= minBorderHeight) {
          topDown = true;
        }
        // new border added will have larger height
        if (topDown) {
          topborder.add(
              new TopBorder(
                  BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                  topborder.get(topborder.size() - 1).getX() + 20,
                  0,
                  topborder.get(topborder.size() - 1).getHeight() + 1));
        }
        // new border added wil have smaller height
        else {
          topborder.add(
              new TopBorder(
                  BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                  topborder.get(topborder.size() - 1).getX() + 20,
                  0,
                  topborder.get(topborder.size() - 1).getHeight() - 1));
        }
      }
    }
  }
示例#23
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;

    if (v == null) {
      LayoutInflater vi =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v = vi.inflate(R.layout.highscore_row, null);
    }
    Player player = (Player) getItem(position);

    Log.d("usernameAdapter", Integer.toString(position));
    Log.d("usernameAdapter", player.getUsername());

    if (player != null) {
      TextView nameAndRank = (TextView) v.findViewById(R.id.playerNameRank);
      TextView winsLossText = (TextView) v.findViewById(R.id.winsLossText);
      TextView score = (TextView) v.findViewById(R.id.score);
      ImageView imageView = (ImageView) v.findViewById(R.id.avatar);

      if (nameAndRank != null) {
        String tmp = Integer.toString(player.getRank()) + ". " + player.getUsername();
        nameAndRank.setText(tmp);
      }

      if (winsLossText != null) {
        String tmp =
            "Wins: "
                + Integer.toString(player.getWins())
                + " Loss: "
                + Integer.toString(player.getLoss());
        winsLossText.setText(tmp);
      }

      if (score != null) {
        score.setText(Integer.toString(player.getScore()));
      }

      if (imageView != null) {
        imageView.setImageResource(Constants.profileArray[player.getImageId()]);
      }
    }
    return v;
  }
示例#24
0
  public void drawText(Canvas canvas) {
    Paint paint = new Paint();
    paint.setColor(Color.BLACK);
    paint.setTextSize(30);
    paint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
    canvas.drawText("DISTANCE: " + (player.getScore() * 3), 10, HEIGHT - 10, paint);
    canvas.drawText("BEST: " + best, WIDTH - 215, HEIGHT - 10, paint);

    if (!player.getPlaying() && newGameCreated && reset) {
      Paint paint1 = new Paint();
      paint1.setTextSize(40);
      paint1.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD));
      canvas.drawText("PRESS TO START", WIDTH / 2 - 50, HEIGHT / 2, paint1);

      paint1.setTextSize(20);
      canvas.drawText("PRESS AND HOLD TO GO UP", WIDTH / 2 - 50, HEIGHT / 2 + 20, paint1);
      canvas.drawText("RELEASE TO GO DOWN", WIDTH / 2 - 50, HEIGHT / 2 + 40, paint1);
    }
  }
示例#25
0
  @Test
  public void test_Jamaal_plays_zilch() {
    ZilchGame z = new ZilchGame();
    Player p, j;
    z.add(p = new Player("Jamaal"));
    z.add(j = new Player("Hussein"));

    p.addPoints(0);
    p.addPoints(0);
    p.addPoints(0);

    j.addPoints(0);
    j.addPoints(0);
    j.addPoints(0);

    j.addPoints(0);
    j.addPoints(0);
    j.addPoints(0);

    assertEquals((-1000), j.getScore());

    ArrayList<Die> dice = z.getDice();

    dice.get(0).setFace(1);

    Player pablo = z.getCurrentPlayer();

    int score = z.getScore(pablo);

    pablo.play(new boolean[] {true, false, false, false, false, false});

    assertEquals(5, z.getDice().size());

    dice = z.getDice();

    dice.get(0).setFace(3);
    pablo.play(new boolean[] {true, false, false, false, false});
    System.out.println(z.getScore(pablo));
    System.out.println(score);
    System.out.println(pablo.getName());

    assertTrue(z.getScore(pablo) + 1000 == score);
  }
示例#26
0
  public void updateBottomBorder() {
    // every 40 points, insert randomly placed bottom blocks that break pattern
    if (player.getScore() % 40 == 0) {
      botborder.add(
          new BotBorder(
              BitmapFactory.decodeResource(getResources(), R.drawable.brick),
              botborder.get(botborder.size() - 1).getX() + 20,
              (int) ((rand.nextDouble() * maxBorderHeight) + (HEIGHT - maxBorderHeight))));
    }

    // update bottom border
    for (int i = 0; i < botborder.size(); i++) {
      botborder.get(i).update();

      // if border is moving off screen, remove it and add a corresponding new one
      if (botborder.get(i).getX() < -20) {
        botborder.remove(i);

        // determine if border will be moving up or down
        if (botborder.get(botborder.size() - 1).getY() <= HEIGHT - maxBorderHeight) {
          botDown = true;
        }
        if (botborder.get(botborder.size() - 1).getY() >= HEIGHT - minBorderHeight) {
          botDown = false;
        }

        if (botDown) {
          botborder.add(
              new BotBorder(
                  BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                  botborder.get(botborder.size() - 1).getX() + 20,
                  botborder.get(botborder.size() - 1).getY() + 1));
        } else {
          botborder.add(
              new BotBorder(
                  BitmapFactory.decodeResource(getResources(), R.drawable.brick),
                  botborder.get(botborder.size() - 1).getX() + 20,
                  botborder.get(botborder.size() - 1).getY() - 1));
        }
      }
    }
  }
  @Test
  public void doPost_shouldPopulateResponseWithCorrectData_whenServletPathIsPlayHumanVsRobot()
      throws ServletException, IOException, JSONException {
    // Setup
    Gesture expectedHumanGesture = Gesture.PAPER;
    Gesture expectedRobot3Gesture = Gesture.ROCK;
    int expectedHumanScore = 5;
    int expectedRobot3Score = 10;
    Result expectedResult = Result.PLAYER1;
    when(request.getServletPath()).thenReturn(PATH_HUMAN_VS_ROBOT);
    when(session.getAttribute(KEY_HUMAN_PLAYER)).thenReturn(humanPlayer);
    when(session.getAttribute(KEY_ROBOT3)).thenReturn(robot3);
    when(humanPlayer.getGesture()).thenReturn(expectedHumanGesture);
    when(robot3.getGesture()).thenReturn(expectedRobot3Gesture);
    when(humanPlayer.getScore()).thenReturn(expectedHumanScore);
    when(robot3.getScore()).thenReturn(expectedRobot3Score);
    when(game.play(humanPlayer, robot3)).thenReturn(expectedResult);

    // Test
    gameServlet.doPost(request, response);

    // Verify
    verify(writer).print(captorJson.capture());
    assertEquals(
        "Response is not as expected",
        expectedHumanGesture,
        captorJson.getValue().get(KEY_PLAYER1_GESTURE));
    assertEquals(
        "Response is not as expected",
        expectedRobot3Gesture,
        captorJson.getValue().get(KEY_PLAYER2_GESTURE));
    assertEquals(
        "Response is not as expected",
        expectedHumanScore,
        captorJson.getValue().get(KEY_PLAYER1_SCORE));
    assertEquals(
        "Response is not as expected",
        expectedRobot3Score,
        captorJson.getValue().get(KEY_PLAYER2_SCORE));
    assertEquals(
        "Response is not as expected", expectedResult, captorJson.getValue().get(KEY_RESULT));
  }
  /** Test of setScore method, of class Player. */
  @Test
  public void testSetScore() {
    assertTrue(player1.getScore() == 0);
    assertTrue(player2.getScore() == 0);

    player1.setScore(100);
    player2.setScore(999);
    assertTrue(player1.getScore() == 100);
    assertTrue(player2.getScore() == 999);

    player1.setScore(999);
    player2.setScore(100);
    assertTrue(player1.getScore() == 999);
    assertTrue(player2.getScore() == 100);
  }
  /** Test of increaseScore method, of class Player. */
  @Test
  public void testIncreaseScore() {
    assertTrue(player1.getScore() == 0);
    assertTrue(player2.getScore() == 0);

    player1.increaseScore(10);
    player2.increaseScore(20);

    assertTrue(player1.getScore() == 10);
    assertTrue(player2.getScore() == 20);

    player1.increaseScore(20);
    player2.increaseScore(10);

    assertTrue(player1.getScore() == 30);
    assertTrue(player2.getScore() == 30);
  }
示例#30
0
 @Override
 public void use(Entity user) {
   if (user instanceof Player && ((Player) user).getTeam() == team) {
     Player player = (Player) user;
     if (player.carrying == null && player.getScore() >= COST[type]) {
       player.payCost(COST[type]);
       Building item = null;
       switch (type) {
         case SHOP_TURRET:
           item = new Turret(pos.x, pos.y, team);
           break;
         case SHOP_HARVESTER:
           item = new Harvester(pos.x, pos.y, team);
           break;
         case SHOP_BOMB:
           item = new Bomb(pos.x, pos.y);
           break;
       }
       level.addEntity(item);
       player.pickup(item);
     }
   }
 }