Class Tourist
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.Tourist
- All Implemented Interfaces:
Saveable<TouristMemento>,Enemies
Tourist enemy that dances idly and flees when startled by kills.
-
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(TouristMemento memento) Restores the object's state from a memento.voidpatrol(float deltaTime) Makes the enemy patrol around its area.static booleanscaredTourists(GameField gameField, com.badlogic.gdx.math.Vector2 deathPosition) Scares all tourists near a death position.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
-
Tourist
public Tourist(com.badlogic.gdx.math.Vector2 startPos)
-
-
Method Details
-
scaredTourists
public static boolean scaredTourists(GameField gameField, com.badlogic.gdx.math.Vector2 deathPosition) Scares all tourists near a death position.- Parameters:
gameField- Game field to find touristsdeathPosition- Position of death- Returns:
- True if any tourists were scared
-
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
-
AnimationDirection
public void AnimationDirection()Description copied from interface:EnemiesUpdates enemy animation based on movement direction.- Specified by:
AnimationDirectionin interfaceEnemies
-
flee
public void flee()Description copied from interface:EnemiesMakes the enemy flee in a random direction. -
patrol
public void patrol(float deltaTime) 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<TouristMemento>- 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<TouristMemento>- Parameters:
memento- The memento containing the state to restore
-