Class Trap
java.lang.Object
de.tum.cit.fop.maze.objects.GameObject
de.tum.cit.fop.maze.objects.traps.Trap
- Direct Known Subclasses:
FreezeTrap,GarlicTrap
Base class for traps that apply effects on player contact.
-
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
ConstructorsConstructorDescriptionTrap(com.badlogic.gdx.math.Vector2 startPos, com.badlogic.gdx.math.Vector2 spriteSizes, com.badlogic.gdx.math.Vector2 spriteShift, AnimationType animationType) -
Method Summary
Modifier and TypeMethodDescriptionvoidanimate(com.badlogic.gdx.graphics.g2d.Batch batch) Renders the object using its drawable or texture.voidcheckPlayerCollision(Player player, HUD hud) Checks collision with player and triggers trap effect.protected abstract voidMethods 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
-
Trap
public Trap(com.badlogic.gdx.math.Vector2 startPos, com.badlogic.gdx.math.Vector2 spriteSizes, com.badlogic.gdx.math.Vector2 spriteShift, AnimationType animationType)
-
-
Method Details
-
animate
public void animate(com.badlogic.gdx.graphics.g2d.Batch batch) Description copied from class:GameObjectRenders the object using its drawable or texture.- Overrides:
animatein classGameObject- Parameters:
batch- Sprite batch for rendering
-
onEnter
-
checkPlayerCollision
Checks collision with player and triggers trap effect.- Parameters:
player- The playerhud- HUD for UI updates
-