Browse Source

aufgeräumt

master
fdai7222 3 years ago
parent
commit
6c0d570c05
  1. 1
      spaceinvaders/GameProject/bin/.gitignore
  2. BIN
      spaceinvaders/GameProject/bin/base/MovingObjectsGame.class
  3. BIN
      spaceinvaders/GameProject/bin/collider/package-info.class
  4. BIN
      spaceinvaders/GameProject/bin/controller/CollisionAwareEgoController.class
  5. BIN
      spaceinvaders/GameProject/bin/controller/EgoController.class
  6. BIN
      spaceinvaders/GameProject/bin/controller/ObjectController.class
  7. BIN
      spaceinvaders/GameProject/bin/gameobjects/package-info.class
  8. 2
      spaceinvaders/GameProject/bin/log4j2.xml
  9. BIN
      spaceinvaders/GameProject/bin/playground/LevelMovingObjects.class
  10. BIN
      spaceinvaders/GameProject/bin/playground/SpaceInvadersLevel.class
  11. BIN
      spaceinvaders/GameProject/bin/playground/SpaceInvadersLevelAua.class
  12. BIN
      spaceinvaders/GameProject/bin/playground/SpaceInvadersLevelTest.class
  13. BIN
      spaceinvaders/GameProject/bin/playground/package-info.class
  14. 14
      spaceinvaders/GameProject/log/log4j.log
  15. 81
      spaceinvaders/GameProject/src/playground/SpaceInvadersLevelTest.java

1
spaceinvaders/GameProject/bin/.gitignore

@ -1 +0,0 @@
/playground/

BIN
spaceinvaders/GameProject/bin/base/MovingObjectsGame.class

BIN
spaceinvaders/GameProject/bin/collider/package-info.class

BIN
spaceinvaders/GameProject/bin/controller/CollisionAwareEgoController.class

BIN
spaceinvaders/GameProject/bin/controller/EgoController.class

BIN
spaceinvaders/GameProject/bin/controller/ObjectController.class

BIN
spaceinvaders/GameProject/bin/gameobjects/package-info.class

2
spaceinvaders/GameProject/bin/log4j2.xml

@ -7,7 +7,7 @@
<PatternLayout pattern="%d %-5level %logger{36} - %msg%n" /> <PatternLayout pattern="%d %-5level %logger{36} - %msg%n" />
</Console> </Console>
<File name="File" fileName="log\log4j.log">
<File name="File" fileName="log/log4j.log">
<PatternLayout pattern="%d %-5level %logger{36} - %msg%n" /> <PatternLayout pattern="%d %-5level %logger{36} - %msg%n" />
</File> </File>

BIN
spaceinvaders/GameProject/bin/playground/LevelMovingObjects.class

BIN
spaceinvaders/GameProject/bin/playground/SpaceInvadersLevel.class

BIN
spaceinvaders/GameProject/bin/playground/SpaceInvadersLevelAua.class

BIN
spaceinvaders/GameProject/bin/playground/SpaceInvadersLevelTest.class

BIN
spaceinvaders/GameProject/bin/playground/package-info.class

14
spaceinvaders/GameProject/log/log4j.log

@ -1080,3 +1080,17 @@
2022-05-13 10:06:30,041 INFO playground.SpaceInvadersLevel - no enemies left, level done. 2022-05-13 10:06:30,041 INFO playground.SpaceInvadersLevel - no enemies left, level done.
2022-05-13 10:06:30,043 INFO base.GameLoop - reached end of levels 2022-05-13 10:06:30,043 INFO base.GameLoop - reached end of levels
2022-05-13 10:06:30,043 INFO base.GameLoop - Game ends. Bye. 2022-05-13 10:06:30,043 INFO base.GameLoop - Game ends. Bye.
2022-05-18 16:16:32,453 INFO base.GameLoop - GUI starts
2022-05-18 16:16:35,213 INFO base.GameLoop - GUI NEW
2022-05-18 16:16:35,214 INFO playground.SpaceInvadersLevel - PREPARE
2022-05-18 16:16:35,267 INFO playground.Animation - img added .\video/sweetAlien0.png
2022-05-18 16:16:35,275 INFO playground.Animation - img added .\video/sweetAlien1.png
2022-05-18 16:16:35,278 INFO playground.Animation - img added .\video/sweetAlien2.png
2022-05-18 16:16:35,282 INFO playground.Animation - img added .\video/sweetAlien3.png
2022-05-18 16:16:35,286 INFO playground.Animation - img added .\video/sweetAlien4.png
2022-05-18 16:16:35,290 INFO playground.Animation - img added .\video/sweetAlien5.png
2022-05-18 16:16:35,294 INFO playground.Animation - img added .\video/sweetAlien6.png
2022-05-18 16:16:35,296 INFO playground.Animation - img added .\video/sweetAlien7.png
2022-05-18 16:16:35,304 INFO playground.Animation - img added .\video/heart0.png
2022-05-18 16:16:35,307 INFO playground.Animation - img added .\video/heart1.png
2022-05-18 16:16:35,311 INFO playground.SpaceInvadersLevel - HIGHSCORE17200

81
spaceinvaders/GameProject/src/playground/SpaceInvadersLevelTest.java

@ -1,81 +0,0 @@
package playground;
import static org.junit.Assert.assertTrue;
import java.awt.Color;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import gameobjects.EgoObject;
import gameobjects.GameObject;
import gameobjects.RectObject;
/**
* Tests {@link SpaceInvadersLevel} for
* <ol>
* <li>calcEnemySpeedX() returns the same value as constant SpaceInvadersLevel.ENEMYSPEEDX
* <li>calcEnemySpeedY() returns the same value as constant SpaceInvadersLevel.ENEMYSPEEDY
* <li>calcNrEnemies() returns the same value as constant SpaceInvadersLevel.NR_ENEMIES
* <li>actionIfEnemyIsHit() adds 200 points to score
* <li>actionIfEgoObjectIsHit() reduces number of lives (egoLives)
* </ol>
* @author jkonert
*
*/
class SpaceInvadersLevelTest {
private static SpaceInvadersLevel myLevel;
@BeforeAll
static void setUpBeforeClass() throws Exception {
myLevel = new SpaceInvadersLevel();
SpaceInvadersLevel.setGlobalFlag("egoLives", 5);
SpaceInvadersLevel.setGlobalFlag("points", 500);
SpaceInvadersLevel.setGlobalFlag("highscore", 5000);
}
@AfterAll
static void tearDownAfterClass() throws Exception {
// nothing
}
@Test
void testCalcEnemySpeedX() {
assertTrue("EnemySpeedX is as in SpaceInvadersLevel defined", myLevel.calcEnemySpeedX() == SpaceInvadersLevel.ENEMYSPEEDX);
}
@Test
void testCalcEnemySpeedY() {
assertTrue("EnemySpeedY is as in SpaceInvadersLevel defined", myLevel.calcEnemySpeedY() == SpaceInvadersLevel.ENEMYSPEEDY);
}
@Test
void testCalcNrEnemies() {
assertTrue("NrOfEnemies is as in SpaceInvadersLevel defined", myLevel.calcNrEnemies() == SpaceInvadersLevel.NR_ENEMIES);
}
@Test
void testActionIfEnemyIsHitPointsUp() {
Integer numPointsBefore = (Integer)Playground.getGlobalFlag("points");
GameObject dummyShot = new RectObject("shot1", myLevel, 0,0,0,0, 12, 12, Color.WHITE);
GameObject dummyEnemy = new RectObject("ego1", myLevel, 0,0,0,0, 12, 12, Color.BLACK);
myLevel.addObject(dummyShot);
myLevel.addObject(dummyEnemy);
myLevel.actionIfEnemyIsHit(dummyEnemy, dummyShot);; // this is the call under test
Integer numPointsAfter = (Integer)Playground.getGlobalFlag("points"); // changed?
assertTrue("numPoints is up +200 after EnemyIsHit", numPointsAfter == numPointsBefore + 200); // points are set +200 , check.
}
@Test
void testActionIfEgoObjectIsHitLivesDown() {
Integer numLivesBefore = (Integer)Playground.getGlobalFlag("egoLives");
GameObject dummyShot = new RectObject("shot1", myLevel, 0,0,0,0, 12, 12, Color.RED);
GameObject dummyEgo = new EgoObject("ego1", myLevel, 0,0,0,0, 5);
myLevel.addObject(dummyShot);
myLevel.actionIfEgoObjectIsHit(dummyShot, dummyEgo); // this is the call under test
Integer numLivesAfter = (Integer)Playground.getGlobalFlag("egoLives"); // changed?
assertTrue("numLives is reduced by one ifEgoIsHit", numLivesAfter == numLivesBefore - 1); // lives is reduced by one
}
}
Loading…
Cancel
Save