Skip to content

Interaction Prompt

abhijithvarma03 edited this page Sep 14, 2023 · 11 revisions

To enable the interaction prompt to show up once the player goes within the interactable range of an entity that is, near the entity, the DistanceCheckComponent and the ProximityControllerComponent work together to make that happen.

DistanceCheckComponent

The DistanceCheckComponent class extends the Component class and takes 2 arguments. The first is distance, which is of type float, this is essentially how much you want the interactable distance to be for the prompt to show up. The second is label, which is an instance of the class InteractLabel.


This is usually initialized with the .addComponent method with the entity that you want the player to interact with. For example: extractor.addComponent(new DistanceCheckComponent(5f, interactLabel));

Clone this wiki locally