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))); }
@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); }
@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); }
// 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); }