Package com.csse3200.game.components
Class PositionSyncComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.PositionSyncComponent
A component that synchronizes the position and velocity of this entity with a
designated "host" entity, maintaining a fixed offset from the host.
This is useful for entities that should follow or remain attached to another moving entity, such as platforms or carried objects.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPositionSyncComponent(Entity host) Creates a newPositionSyncComponentthat will follow the given host entity. -
Method Summary
Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
PositionSyncComponent
Creates a newPositionSyncComponentthat will follow the given host entity.- Parameters:
host- the entity to synchronize position with
-
-
Method Details
-
create
public void create()Description copied from class:ComponentCalled 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. -
update
public void update()Description copied from class:ComponentCalled once per frame of the game, and should be used for most component logic. Not called if component is disabled.
-