You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/scripting/app/Control.md
+34-16Lines changed: 34 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,33 +2,27 @@
2
2
3
3
## `app.control(options)`: Control
4
4
5
-
The `app.control()` method gives you access to user inputs like keyboard and mouse. It's the primary way to create interactive experiences. You can have multiple active controls, and they are prioritized.
5
+
The `app.control()` method gives you access to user inputs like keyboard and mouse and gives you control over the camera etc. It's the primary way to create interactive experiences.
6
6
7
7
```javascript
8
8
// Get a control object
9
-
constcontrols=app.control({ priority:1 })
9
+
constcontrol=app.control()
10
10
11
11
// The app will be cleaned up automatically, but if you need to manually release control:
12
-
controls.release()
12
+
control.release()
13
13
```
14
14
15
-
**Options**
15
+
### Buttons
16
16
17
-
*`priority` (Number): A number that determines the order of input processing. Higher numbers have higher priority. Defaults to `0`. Player controls usually have a low priority, so scripts can override them.
18
-
*`onButtonPress` (Function): A callback for any button press. `(prop, text) => {}`. `prop` is the button property name (e.g. `keyW`), `text` is the character for the key. Return `true` to consume the event.
19
-
20
-
21
-
### Button Events
22
-
23
-
You can listen to press and release events for keyboard keys and mouse buttons.
17
+
Listen to press and release events for keyboard keys and mouse buttons.
0 commit comments