Package org.jpacman.framework.model

Examples of org.jpacman.framework.model.Tile


  /**
   * Basic sanity checks on initial setting.
   */
  @Test
  public void testInitialSetup() {
    Tile playerTile = tileAt(1, 1);
    assertEquals(playerTile, getPlayer().getTile());
    assertTrue(getPlayer().isAlive());
    assertEquals(0, getPlayer().getPoints());
  }
View Full Code Here


    Food food = (Food) game.getBoard().spriteAt(1, 0);
    Player player = game.getPlayer();

    game.movePlayer(Direction.RIGHT);
   
    Tile newTile = tileAt(game, 1, 0);
    assertEquals("Food added", food.getPoints(), player.getPoints());
    assertEquals("Player moved", newTile.topSprite(), player);
    assertFalse("Food gone", newTile.containsSprite(food));
  }
View Full Code Here

    Ghost theGhost = (Ghost) game.getBoard().spriteAt(1, 0);

    game.moveGhost(theGhost, Direction.LEFT);
    assertFalse("Move kills player", game.getPlayer().isAlive());
   
    Tile newTile = theGhost.getTile();
    assertThat(tileAt(game, 0, 0), equalTo(newTile));
  }
View Full Code Here

  @Test
  public void testTunneledMove() throws FactoryException {
    Game g = makePlay("P# ");
    g.movePlayer(Direction.LEFT);
   
    Tile newTile = g.getPlayer().getTile();
    assertThat("Player moved", tileAt(g, 2, 0), equalTo(newTile));
  }
View Full Code Here

   * Test what happens if we relocate a sprite.
   */
  @Test
  public void relocateSprite() {
    john.deoccupy();
    Tile north = new Tile(0, 1);
    john.occupy(north);

    // john now lives at north
    assertThat(north.topSprite(), equalTo(john));

    // but john doesn't live in the center anymore.
    assertFalse(center.containsSprite(john));
  }
View Full Code Here

  /**
   * Testing moves, now with custom made matcher.
   */
  @Test
  public void testMoveWithMatchers() {
    Tile north = new Tile(0, 1);
    john.deoccupy();
    john.occupy(north);
    assertThat(john, occupies(north));
    assertThat(john, not(occupies(center)));
  }
View Full Code Here

  /**
   * The actual test case.
   */
  @Test
  public void testTileAtDirection() {
    Tile source = board.tileAt(startx, starty);
    Tile actual = board.tileAtDirection(source, dir);
    Tile desired = board.tileAt(nextx, nexty);
    assertEquals(desired, actual);
  }
View Full Code Here

TOP

Related Classes of org.jpacman.framework.model.Tile

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.