Skip to content

Commit fe8342e

Browse files
NaejDoreeJean Poree
authored andcommitted
fix(playground): updated the tooltipmodule doc
1 parent a1be72f commit fe8342e

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

playground/extensions/extensions-3-tooltip.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,39 @@ This module can be used to assign some data to an entity from the [GraphicEntity
44

55
You may change the assigned data of each entity once per game turn.
66

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.
89

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+
```

0 commit comments

Comments
 (0)