Package pl.edu.pw.elka.mmarkiew.model.map

Examples of pl.edu.pw.elka.mmarkiew.model.map.BlockHolder


   */
  public GameMap(final Player player, final int widthBlocks, final int heightBlocks)
  {
    this.player = player;
    this.playerStartPosition = new Point(0, 0);
    this.map = new BlockHolder(widthBlocks, heightBlocks);
    this.widthInBlocks = widthBlocks;
    this.heightInBlocks = heightBlocks;
    this.enemies = new LinkedList<Entity>();
    this.bombs = new LinkedList<Bomb>();
    this.bonuses = new LinkedList<Bonus>();
View Full Code Here


   *
   * @param b - Exploding bomb
   */
  private void explodeBomb(Bomb b)
  {
    final BlockHolder blocks = map.getBlockHolder();
    final int xR = GameMap.getTilePosition(b.getX());
    final int yR = GameMap.getTilePosition(b.getY());
    int x, y;

    // Add explosion entity into place where was planted
    map.addEnemy(EntityFactory.createEntity(GameEntities.EXPLOSION, xR, yR));
   
    // If Player is like a ghost and plan into non EmptyBlock it stops expanding
    if (blocks.getBlock(xR, yR) instanceof BrickBlock)
    {
      blocks.setBlock(BlockFactory.createElement(GameBlock.EMPTY), xR, yR);
      Entity blen = EntityFactory.createEntity(GameEntities.DESTROYING_BRICK, xR, yR);
      map.addEnemy(blen);
      return;
    }
   
    /*
     * Makes cross of enemy explosion entities
     * Stops on non EmptyBlock
     */
    for (int i = 0; i < 4; ++i)
    {
      x = xR;
      y = yR;
     
      destroyedBrickAnimation:
      for (int j = 1; j <= b.getArea(); ++j)
      {
       
        /*
         * Way to 'recurse'
         */
        switch (i)
        {
          case 0: x = xR;    y = yR - j; break;
          case 1: x = xR;    y = yR + j; break;
          case 2: x = xR - j; y = yR;    break;
          case 3: x = xR + j; y = yR;    break;
        }
       
        if (blocks.getBlock(x, y) instanceof StoneBlock)
        {
          break;
        }
        else if (blocks.getBlock(x, y) instanceof BrickBlock)
        {
          Entity blen = EntityFactory.createEntity(GameEntities.DESTROYING_BRICK, x, y);
          blocks.setBlock(BlockFactory.createElement(GameBlock.EMPTY), x, y);
          map.addEnemy(blen);
          break;
        }
        else if (blocks.getBlock(x, y) instanceof EmptyBlock)
        {
          Entity blen = EntityFactory.createEntity(GameEntities.EXPLOSION, x, y);

          /*
           * Stops on brick which is dying
View Full Code Here

TOP

Related Classes of pl.edu.pw.elka.mmarkiew.model.map.BlockHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.