Package com.csse3200.game.components.npc
Class SplitMoblings
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.npc.SplitMoblings
A component that splits the target mob entity into multiple entities after
after the mob dies. This class adds a method to the existing event listener
"dieStart".
Amount of moblings spawned must be provided in the construcor. Scaled size of the moblings can be altered in the X and Y direction if desired. If not provided scaling alteration is assumed to be 0.75.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final float
static final String
static final int
static final float
static final float
static final float
static final float
static final double
-
Constructor Summary
ConstructorDescriptionSplitMoblings
(int amount) Initialises a component that splits mob into multiple moblings.SplitMoblings
(int amount, float scale) Initialises a component that splits mob into multiple moblings.SplitMoblings
(int amount, float scaleX, float scaleY) Initialises a component that splits mob into multiple moblings. -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.void
spawnAdditionalMob
(float positionX, float positionY, float initialScaleX, float initialScaleY) Helper function that spawns a xeno grunt based on a x and y-coordinate and scales down/up the entity based on the initial scale and this object's scale.Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Field Details
-
DEFAULT_MINIFIED_SCALE
public static final float DEFAULT_MINIFIED_SCALE- See Also:
-
OFFSET_DISTANCE
public static final double OFFSET_DISTANCE- See Also:
-
FULL_CIRCLE_ANGLE
public static final int FULL_CIRCLE_ANGLE- See Also:
-
MIN_X_BOUNDS
public static final float MIN_X_BOUNDS- See Also:
-
MAX_X_BOUNDS
public static final float MAX_X_BOUNDS- See Also:
-
MIN_Y_BOUNDS
public static final float MIN_Y_BOUNDS- See Also:
-
MAX_Y_BOUNDS
public static final float MAX_Y_BOUNDS- See Also:
-
DIE_START_EVENT
- See Also:
-
-
Constructor Details
-
SplitMoblings
public SplitMoblings(int amount) Initialises a component that splits mob into multiple moblings. Amount of moblings split based on the amount provided param.- Parameters:
amount
- Amount of moblings to be split.- Require:
- amount > 0
-
SplitMoblings
public SplitMoblings(int amount, float scale) Initialises a component that splits mob into multiple moblings. Amount of moblings split is based on the amount provided param. The overalling scaling (x and y) is also altered in the param.- Parameters:
amount
- Amount of moblings to be split.scale
- X and Y scaling of the moblings in respect to the original size of the mobs.- Require:
- amount > 0
-
SplitMoblings
public SplitMoblings(int amount, float scaleX, float scaleY) Initialises a component that splits mob into multiple moblings. Amount of moblings split is based on the amount provided param. The individual scaling (x and y) is also altered in the param.- Parameters:
amount
- Amount of moblings to be split.scaleX
- X scaling of the moblings compared to original size.scaleY
- Y scaling of the moblings compared to original size.- Require:
- amount > 0
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
spawnAdditionalMob
public void spawnAdditionalMob(float positionX, float positionY, float initialScaleX, float initialScaleY) Helper function that spawns a xeno grunt based on a x and y-coordinate and scales down/up the entity based on the initial scale and this object's scale.- Parameters:
positionX
- New spawn x-coordinatepositionY
- New spawn y-coordinateinitialScaleX
- Initial horizontal scale of the entityinitialScaleY
- Initial vertical scale of the entity
-