Package com.csse3200.game.components
Class FollowComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.FollowComponent
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatvoidvoidsetFollowSpeed(float followSpeed) Sets the entities follow speed to the given inputvoidupdate()Update the entity following the followEntity.Methods inherited from class com.csse3200.game.components.Component
create, dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
FollowComponent
- Parameters:
followEntity- - the entity which we are following!followSpeed- - the speed of attraction towards that entity
-
-
Method Details
-
setFollowSpeed
public void setFollowSpeed(float followSpeed) Sets the entities follow speed to the given input- Parameters:
followSpeed- - the speed of which this entity approaches the followEntity. Positive = going towards, negative means repelled away from the followEntity
-
getFollowSpeed
public float getFollowSpeed() -
update
public void update()Update the entity following the followEntity. Check if it exists, and if it does, apply our saved speed movement towards/away from that entityFirstly, get the 'moving' property from the CompanionActions If the moving property is true, don't suck in. If the moving property is false, then suck in.
-
moveEntityTowardFollowingEntity
public void moveEntityTowardFollowingEntity()
-