Class TrapFactory
java.lang.Object
com.csse3200.game.entities.factories.TrapFactory
Factory to create trap entities (objects that damage the player (and possibly enemies)).
Each trap entity type should have a creation method that returns a corresponding entity.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Entity
createSpikes
(com.badlogic.gdx.math.Vector2 safeSpot, float rotation) Creates a basic Spike trap with configurable rotation and length of 1 unit.
-
Constructor Details
-
TrapFactory
public TrapFactory()
-
-
Method Details
-
createSpikes
Creates a basic Spike trap with configurable rotation and length of 1 unit.The Spike trap displays in 16-pixel high x 16-pixel wide units of sprite spikes_sprite.png. It is immovable and cannot be destroyed. On collision with player (or enemy), it damages the colliding entity by 1, and resets their position to a safe location nearby. Spikes are NOT classified as an obstacle the player can hide behind, because they are very short In a future update, the width will configurable based on a provided length parameter.
- Parameters:
safeSpot
- Spot to teleport the player once they take damagerotation
- The rotation (anti-clockwise) in degrees. Must be in {0, 90, 180, 270}.- Returns:
- the Spike trap Entity created.
-