Refactoring and documentation update

This commit is contained in:
Benedicte Quimbert 2021-11-23 17:39:45 +01:00
parent 4356767739
commit 1e073d8a0e
7 changed files with 47 additions and 22 deletions

23
docs/maps/api-camera.md Normal file
View file

@ -0,0 +1,23 @@
{.section-title.accent.text-primary}
# API Camera functions Reference
### Listen to the camera update
```
WA.camera.onCameraUpdate(callback: WasCameraUpdatedEventCallback): void
```
Listens to the updating of the camera linked to the player. It will trigger for every update of the camera's properties (position or scale for instance) or of the Game Object it is linked to (undestand: if the player moves). An event will then be sent.
The event has the following attributes :
* **x (number):** coordinate X of the camera's world view (the area looked at by the camera).
* **y (number):** coordinate Y of the camera's world view.
* **width (number):** the width of the camera's world view.
* **height (number):** the height of the camera's world view.
**callback:** the function that will be called when the camera is updated.
Example :
```javascript
WA.camera.onCameraUpdate((worldView) => console.log(worldView));
```

View file

@ -10,5 +10,6 @@
- [UI functions](api-ui.md)
- [Sound functions](api-sound.md)
- [Controls functions](api-controls.md)
- [Camera functions](api-camera.md)
- [List of deprecated functions](api-deprecated.md)