Class Exit
java.lang.Object
de.tum.cit.fop.maze.objects.GameObject
de.tum.cit.fop.maze.objects.Static.Exit
- All Implemented Interfaces:
Saveable<ExitMemento>
Exit portal that can be locked or unlocked with keys.
-
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 TypeMethodDescriptionCreates a memento capturing the current state of this object.booleanisLocked()Checks if exit is locked.voidloadFromMemento(ExitMemento memento) Restores the object's state from a memento.voidopen()Opens the exit by unlocking it.Methods inherited from class de.tum.cit.fop.maze.objects.GameObject
animate, changeAnimation, entitiesOverlap, getBounds, getDrawable, getSize, getSpeed, getVelocity, increaseSpeed, move, multiplySpeed, nextPosition, setAnimationTime, updateAnimation
-
Constructor Details
-
Exit
public Exit(float x, float y)
-
-
Method Details
-
open
public void open()Opens the exit by unlocking it. -
isLocked
public boolean isLocked()Checks if exit is locked.- Returns:
- True if locked
-
getMemento
Description copied from interface:SaveableCreates a memento capturing the current state of this object.- Specified by:
getMementoin interfaceSaveable<ExitMemento>- 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<ExitMemento>- Parameters:
memento- The memento containing the state to restore
-