File tree Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Expand file tree Collapse file tree 1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,39 @@ This module can be used to assign some data to an entity from the [GraphicEntity
4
4
5
5
You may change the assigned data of each entity once per game turn.
6
6
7
- The majority of the text to display should be written into your copy of the tooltip module to reduce the amount of data the Referee must produce.
7
+ ## Import
8
+ ⚠ This module requires the [ GraphicEntityModule] ( https://github.com/CodinGame/codingame-game-engine/tree/master/engine/modules/entities ) to work.
8
9
9
- ⚠ This example might require you modify it for proper use in your own game.
10
+ Add the dependency in the ` pom.xml ` of your project.
11
+ ``` xml
12
+ <dependency >
13
+ <groupId >com.codingame.gameengine</groupId >
14
+ <artifactId >module-tooltip</artifactId >
15
+ <version >3.2.0</version >
16
+ </dependency >
17
+ ```
18
+ And load the module in your ` config.js ` .
19
+ ``` javascript
20
+ import { GraphicEntityModule } from ' ./entity-module/GraphicEntityModule.js' ;
21
+ import { TooltipModule } from ' ./tooltip-module/TooltipModule.js' ;
22
+
23
+ export const modules = [
24
+ GraphicEntityModule,
25
+ TooltipModule
26
+ ];
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ` Referee.java `
32
+ ``` java
33
+ // adding a tooltip to an entity
34
+ tooltip. setTooltipText(myEntity, " the tooltip text linked to this entity" );
35
+
36
+ // removing the tooltip from an other entity
37
+ tooltip. removeTooltipText(otherEntity);
38
+
39
+ // getting the tooltip text associated to an entity
40
+ String text = tooltip. getTooltipText(myEntity);
41
+ // in this case text will now be "the tooltip text linked to this entity"
42
+ ```
You can’t perform that action at this time.
0 commit comments