Package playground
Class Level4
java.lang.Object
playground.Playground
playground.SpaceInvadersLevel
playground.Level4
extends
SpaceInvadersLevel
with aliens that need two hits to be destroyed.
- Hit aliens twice to kill them
- they say AUA when not destroyed
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
constant defining the number of shots needed to destroy an enemyFields inherited from class playground.SpaceInvadersLevel
alienImage, alienshowTime, BONUS_DURATION, CANVASX, CANVASY, doneLevel, DYING_INTERVAL, EGORAD, EGOSPEED, enemyAnim, ENEMYSCALE, ENEMYSHOTSPEED, ENEMYSPEEDX, ENEMYSPEEDY, EXPL_COLOR, EXPL_DURATION, heartAnim, heartImage, heartshowTime, laser, LEVEL_INIT_TIME, LEVEL2STARS, lost, nextShot, NR_COLLECT, NR_ENEMIES, NRSHARDS, SHARDSPEED, SHOTSPEED, smash, STARSPEED, STARTPERIOD, STARTTEXTSPEED, starttime
Fields inherited from class playground.Playground
addables, canvasX, canvasY, flags, FLAGS_ALL, FLAGS_GLOBAL, FLAGS_LEVEL, gameObjects, gameTime, keyEvents, level, mouseEvents, pausedFlag, removables, timeStep
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void
actionIfEnemyIsHit
(GameObject e, GameObject shot) implements game behavior if an enemy object is hit by a players' shot.protected String
simply returns the text that should be displayed at level startMethods inherited from class playground.SpaceInvadersLevel
actionIfEgoCollidesWithCollect, actionIfEgoCollidesWithEnemy, actionIfEgoObjectIsHit, applyGameLogic, calcEnemyShotProb, calcEnemySpeedX, calcEnemySpeedY, calcNrCollect, calcNrEnemies, createCollectables, createEgoObject, createEnemies, createEnemyController, createEnemyShot, createEnemyShotObject, createExplosion, createSingleCollect, createSingleEnemy, createStars, gameOver, levelFinished, preferredSizeX, preferredSizeY, prepareLevel, redrawLevel, setupInitialState
Methods inherited from class playground.Playground
addObject, addObjectNow, collectObjects, deleteObject, deleteObjectNow, getGameTime, getGlobalFlag, getKeyEvents, getLevelFlag, getMouseEvents, getObject, getOrCreateGlobalFlag, getOrCreateLevelFlag, getSizeX, getSizeY, getTimestep, isPaused, processKeyEvents, processMouseEvents, redraw, reset, resetFlags, setGameTime, setGlobalFlag, setLevelFlag, setPaused, setTimestep, togglePause, updateObjects
-
Field Details
-
MAX_HITS
public static final int MAX_HITSconstant defining the number of shots needed to destroy an enemy- See Also:
-
-
Constructor Details
-
Level4
public Level4()
-
-
Method Details
-
getStartupMessage
Description copied from class:SpaceInvadersLevel
simply returns the text that should be displayed at level start- Overrides:
getStartupMessage
in classSpaceInvadersLevel
- Returns:
- a string that is displayed at start. Should be not longer than 30 characters.
-
actionIfEnemyIsHit
Description copied from class:SpaceInvadersLevel
implements game behavior if an enemy object is hit by a players' shot. It creates an explosion effect, plays a sound and adds 200 points to the current score (and it removes the enemy object and the shot object).- Overrides:
actionIfEnemyIsHit
in classSpaceInvadersLevel
- Parameters:
e
- enemy which was hitshot
- the shot object that hit the enemy
-