/** 加载精灵 */
  public void addSpr() {
    bs = new BattleScene();
    bs.initialize(
        SystemData.getActivityHeight(),
        SystemData.getActivityWidth(),
        SImage.createImage("/res/bg1.jpg"));
    bs.load(getResources());
    SystemData.setCurrentScene(bs);
    ds1 = new DynamicSprite(10, 10, 1, true);
    ds2 = new DynamicSprite(10, 10, 2, true);
    ds4 = new DynamicSprite(x1 - 150, 10, 3, true);
    ds5 = new DynamicSprite(x1 - 150, 10, 4, true);

    ds1.load(SImage.createImage("/res/hero1.png"));
    ds2.load(SImage.createImage("/res/hero2.png"));
    ds4.load(SImage.createImage("/res/enemy1.png"));
    ds5.load(SImage.createImage("/res/enemy2.png"));
    dsList.add(ds1);
    dsList.add(ds2);
    dsList.add(ds5);
    dsList.add(ds4);
    bs.addSprite(
        ds1, SImage.createImage("/res/hero1.png"), SystemData.getActivityHeight() / 3, 120);
    bs.addSprite(
        ds4, SImage.createImage("/res/enemy1.png"), SystemData.getActivityHeight() / 3, 200);
  }
Ejemplo n.º 2
0
  /** Tests initialization */
  @Test
  public void testInit() {
    BattleScene b = new BattleScene();

    assertEquals(null, b.getSystem());
    assertEquals(null, b.getDisplay());

    b.start();

    // should make a blank formation
    assertTrue(((BattleSystem) b.getSystem()).getFormation().size() == 0);
  }
Ejemplo n.º 3
0
  /** Tests intitializing with a formation */
  @Test
  public void testInitWithFormation() {
    BattleScene b = new BattleScene();
    Formation f = new Formation();
    f.add(new Enemy("Gel"));

    assertEquals(null, b.getSystem());
    assertEquals(null, b.getDisplay());

    b.start(f);

    assertEquals(f, ((BattleSystem) b.getSystem()).getFormation());
  }