Class Bouncer
java.lang.Object
de.tum.cit.fop.maze.objects.GameObject
de.tum.cit.fop.maze.objects.Dynamic.Enemy.Enemy
de.tum.cit.fop.maze.objects.Dynamic.Enemy.Bouncer
- All Implemented Interfaces:
Saveable<BouncerMemento>,Enemies
Bouncer enemy with multiple lives that intelligently chases the player.
-
Field Summary
Fields inherited from class de.tum.cit.fop.maze.objects.GameObject
bounds, currentAnimationType, drawable, position, sizes, speed, speedMultiplier, spriteSizes, texture, velocity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidanimate(com.badlogic.gdx.graphics.g2d.Batch batch) Renders the object using its drawable or texture.voidUpdates enemy animation based on movement direction.voidMakes the enemy chase the player.voidflee()Makes the enemy flee in a random direction.Creates a memento capturing the current state of this object.voidloadFromMemento(BouncerMemento memento) Restores the object's state from a memento.voidpatrol(float delta) Makes the enemy patrol around its area.booleantakeDamage(com.badlogic.gdx.math.Vector2 playerPos) Handles damage and fleeing behavior.voidupdateBehavior(float deltaTime, com.badlogic.gdx.math.Vector2 playerPosition, GameField gameField, Player player) Updates enemy behavior including chasing and idle states.Methods inherited from class de.tum.cit.fop.maze.objects.Dynamic.Enemy.Enemy
getEnemyEntity, getPosition, isDead, onDeath, setDead, shouldRemove, updateDeathAnimation, WallOrObstacleMethods inherited from class de.tum.cit.fop.maze.objects.GameObject
changeAnimation, entitiesOverlap, getBounds, getDrawable, getSize, getSpeed, getVelocity, increaseSpeed, move, multiplySpeed, nextPosition, setAnimationTime, updateAnimation
-
Constructor Details
-
Bouncer
public Bouncer(com.badlogic.gdx.math.Vector2 startPos)
-
-
Method Details
-
updateBehavior
public void updateBehavior(float deltaTime, com.badlogic.gdx.math.Vector2 playerPosition, GameField gameField, Player player) Description copied from class:EnemyUpdates enemy behavior including chasing and idle states.- Overrides:
updateBehaviorin classEnemy- Parameters:
deltaTime- Time since last updateplayerPosition- Player's current positiongameField- Game field for navigationplayer- Player reference
-
animate
public void animate(com.badlogic.gdx.graphics.g2d.Batch batch) Description copied from class:GameObjectRenders the object using its drawable or texture. -
AnimationDirection
public void AnimationDirection()Description copied from interface:EnemiesUpdates enemy animation based on movement direction.- Specified by:
AnimationDirectionin interfaceEnemies
-
takeDamage
public boolean takeDamage(com.badlogic.gdx.math.Vector2 playerPos) Handles damage and fleeing behavior.- Parameters:
playerPos- Player position for flee direction- Returns:
- True if enemy died, false if survived
-
flee
public void flee()Description copied from interface:EnemiesMakes the enemy flee in a random direction. -
patrol
public void patrol(float delta) Description copied from interface:EnemiesMakes the enemy patrol around its area. -
chase
public void chase(float deltaTime, com.badlogic.gdx.math.Vector2 playerPosition, GameField gameField) Description copied from interface:EnemiesMakes the enemy chase the player. -
getMemento
Description copied from interface:SaveableCreates a memento capturing the current state of this object.- Specified by:
getMementoin interfaceSaveable<BouncerMemento>- Returns:
- A memento containing the object's state
-
loadFromMemento
Description copied from interface:SaveableRestores the object's state from a memento.- Specified by:
loadFromMementoin interfaceSaveable<BouncerMemento>- Parameters:
memento- The memento containing the state to restore
-