Class Junkie
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.Junkie
- All Implemented Interfaces:
Saveable<JunkieMemento>,Enemies
Junkie enemy that randomly moves and occasionally attacks nearby players.
-
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 TypeMethodDescriptionvoidUpdates 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(JunkieMemento memento) Restores the object's state from a memento.voidpatrol(float delta) Makes the enemy patrol around its area.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
animate, 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
-
Junkie
public Junkie(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
-
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. -
AnimationDirection
public void AnimationDirection()Description copied from interface:EnemiesUpdates enemy animation based on movement direction.- Specified by:
AnimationDirectionin interfaceEnemies
-
getMemento
Description copied from interface:SaveableCreates a memento capturing the current state of this object.- Specified by:
getMementoin interfaceSaveable<JunkieMemento>- 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<JunkieMemento>- Parameters:
memento- The memento containing the state to restore
-