Package playground
Class LevelMovingHitObjects
java.lang.Object
playground.Playground
playground.SpaceInvadersLevel
playground.LevelMovingHitObjects
Level that creates two RectObjects moving around and if ego is hit by them game is directly lost
(lives = 0).
-
Field Summary
Fields 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
actionIfEgoCollidesWithEnemy
(GameObject enemy, GameObject ego) implements behaviour of game when ego object is touching an enemy.protected String
"Moving Hitting Objects Level!"void
prepareLevel
(String id) initially sets up the level.Methods inherited from class playground.SpaceInvadersLevel
actionIfEgoCollidesWithCollect, actionIfEgoObjectIsHit, actionIfEnemyIsHit, applyGameLogic, calcEnemyShotProb, calcEnemySpeedX, calcEnemySpeedY, calcNrCollect, calcNrEnemies, createCollectables, createEgoObject, createEnemies, createEnemyController, createEnemyShot, createEnemyShotObject, createExplosion, createSingleCollect, createSingleEnemy, createStars, gameOver, levelFinished, preferredSizeX, preferredSizeY, 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
-
Constructor Details
-
LevelMovingHitObjects
public LevelMovingHitObjects()
-
-
Method Details
-
prepareLevel
Description copied from class:SpaceInvadersLevel
initially sets up the level. Not called by user interaction, but called every time a layer is restarted from scratch. So make sure that this is possible. Here, resources are loaded only once even if method is called several times.- Overrides:
prepareLevel
in classSpaceInvadersLevel
- Parameters:
id
- String identifies level.
-
actionIfEgoCollidesWithEnemy
Description copied from class:SpaceInvadersLevel
implements behaviour of game when ego object is touching an enemy. It displays a text "AUAA!!" for a certain time on the game screen. Time span is defined as constant inSpaceInvadersLevel.BONUS_DURATION
.- Overrides:
actionIfEgoCollidesWithEnemy
in classSpaceInvadersLevel
- Parameters:
enemy
- the enemy that was hitego
- the ego object of the player
-
getStartupMessage
"Moving Hitting Objects Level!" is the message.- Overrides:
getStartupMessage
in classSpaceInvadersLevel
- Returns:
- String "Moving & Hitting Objects Level!"
-