示例#1
0
 private void init(String mapName, int x, int y) {
   mapUtils.loadMap(mapName);
   squirrel = spawnZildo(x, y);
   Assert.assertEquals(Constantes.ZILDO_SPEED, squirrel.getSpeed(), 0f);
   squirrel.setAppearance(ControllablePerso.PRINCESS_BUNNY);
   Assert.assertEquals(Constantes.ROXY_SPEED, squirrel.getSpeed(), 0f);
   waitEndOfScripting();
 }
 @Override
 protected void focusOnZildo() {
   // Focus camera on Zildo, and zoom according to the 'fadeLevel'
   PersoPlayer zildo = EngineZildo.persoManagement.getZildo();
   Point zildoPos = zildo.getCenteredScreenPosition();
   ClientEngineZildo.openGLGestion.setZoomPosition(zildoPos);
   float z = 2.0f * (float) Math.sin(getFadeLevel() * (0.25f * Math.PI / 256.0f));
   ClientEngineZildo.openGLGestion.setZ(z);
   // EngineZildo.getOpenGLGestion().setZ((float) Math.sin(getFadeLevel() * (0.5f*Math.PI /
   // 256.0f)));
 }
示例#3
0
  @Test
  public void jumpFromStumpUnderMud() {
    init("sousbois6", 207, 428);
    squirrel.z = 5;

    squirrel.jump();
    int maxZ = 0;
    for (int i = 0; i < 100; i++) {
      renderFrames(1);
      maxZ = Math.max((int) squirrel.z, maxZ);
    }
    Assert.assertTrue("Squirrel should have reach z=10, but measured max was " + maxZ, maxZ > 10);
  }
示例#4
0
  @Test
  public void fallFromStumpOnPlot() {
    // Place squirrel on a high stump, just on the right of a plot
    init("sousbois3", 222, 506);
    squirrel.z = 8;

    // Walks to fall on the plot
    simulateDirection(new Vector2f(-1, 0));

    renderFrames(30);
    Assert.assertEquals(MouvementZildo.TOMBE, squirrel.getMouvement());
    simulateDirection(null);
    renderFrames(30);
    Assert.assertEquals(MouvementZildo.VIDE, squirrel.getMouvement());

    Assert.assertEquals(0, (int) squirrel.z);
  }
示例#5
0
  // Squirrel shouldn't from mud (because its jumps is lower)
  @Test
  public void jumpOnStumpUnderMud() {
    init("sousbois6", 207, 401);

    // Walk to the stump
    simulateDirection(new Vector2f(0, 1f));
    renderFrames(10);

    // Check that squirrel doesn't walk on stump without jumping
    Assert.assertEquals(0, (int) squirrel.z);

    squirrel.jump();
    renderFrames(20);
    Assert.assertEquals(0, (int) squirrel.z);
  }