Package org.jpacman.framework.model

Examples of org.jpacman.framework.model.Game.moveGhost()


  @Test
  public void testC1b_GhostMovesToEmpty() throws FactoryException {
    Game g = makePlay("G #");
    Ghost theGhost = (Ghost) g.getBoard().spriteAt(0, 0);

    g.moveGhost(theGhost, Direction.RIGHT);
   
    assertEquals("Ghost moved", tileAt(g, 1, 0), theGhost.getTile());
  }

View Full Code Here


  @Test
  public void testC2b_GhostMovesToWall() throws FactoryException {
    Game g = makePlay(" G#");
    Ghost theGhost = (Ghost) g.getBoard().spriteAt(1, 0);

    g.moveGhost(theGhost, Direction.RIGHT);
   
    assertEquals("Ghost not moved", tileAt(g, 1, 0), theGhost.getTile());
  }

 
View Full Code Here

  @Test
  public void testC4_GhostMovesToPlayer() throws FactoryException {   
    Game game = makePlay("PG#");
    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 testC6_GhostMovesToFood() throws FactoryException {
    Game game = makePlay("G.#");
    Ghost theGhost = (Ghost) game.getBoard().spriteAt(0, 0);

    game.moveGhost(theGhost, Direction.RIGHT);   
    assertEquals("Ghost moved", tileAt(game, 1, 0), theGhost.getTile());

    game.moveGhost(theGhost, Direction.LEFT);
    assertEquals(SpriteType.FOOD, game.getBoard().spriteTypeAt(1, 0));
  }
View Full Code Here

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

    game.moveGhost(theGhost, Direction.RIGHT);   
    assertEquals("Ghost moved", tileAt(game, 1, 0), theGhost.getTile());

    game.moveGhost(theGhost, Direction.LEFT);
    assertEquals(SpriteType.FOOD, game.getBoard().spriteTypeAt(1, 0));
  }

 
  /**
 
View Full Code Here

    Observer anObserver = mock(Observer.class);
    Game game = makePlay("G #");
    game.addObserver(anObserver);
    Ghost ghost = (Ghost) game.getBoard().spriteAt(0, 0);
    // when
    game.moveGhost(ghost, Direction.RIGHT);
    // then
    verify(anObserver).update(any(Observable.class), anyObject());
  }
 
  /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.