Skip to content

Commit

Permalink
Merge pull request #94 from Genymobile/dev/PLAYER-30-change-keymappin…
Browse files Browse the repository at this point in the history
…g-config-json

[PLAYER-30] remplace the key 'keys' to 'key' for keympapping tap et swipe
  • Loading branch information
jparez authored Sep 3, 2024
2 parents 2ba52d4 + c23c0d4 commit 9376b49
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 159 deletions.
96 changes: 57 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,67 +169,85 @@ sendData({
### `keymapping`

- #### `setConfig`

supply a config for keymapping

```js
{
dpad:[{
keys: {
z: {
initialX: 20,
initialY: 80,
distanceX: 0,
distanceY: -10,
dPad:[{
keys:[
{
key: 'w',
effect: {
initialX: 20,
initialY: 80,
distanceX: 0,
distanceY: -10,
},
name: 'up',
description: 'move up',
},
s: {
initialX: 20,
initialY: 80,
distanceX: 0,
distanceY: 10,
{
key: 's',
effect: {
initialX: 20,
initialY: 80,
distanceX: 0,
distanceY: 10,
},
name: 'down',
description: 'move down',
},
q: {
initialX: 20,
initialY: 80,
distanceX: -10,
distanceY: 0,
{
key: 'a',
effect: {
initialX: 20,
initialY: 80,
distanceX: -10,
distanceY: 0,
},
name: 'left',
description: 'move left',
},
d: {
initialX: 20,
initialY: 80,
distanceX: 10,
distanceY: 0,
{
key: 'd',
effect: {
initialX: 20,
initialY: 80,
distanceX: 10,
distanceY: 0,
},
name: 'up',
description: 'move right',
},
},
],
name: 'character movement',
description: 'left joystick used to move the character',
}],
tap:[{
keys: {
p: {
initialX: 50,
initialY: 50,
},
}
key: 'p',
effect: {
initialX: 50,
initialY: 50,
},
name:'Fire'
}],
swipe: [{
keys: {
u: {
initialX: 50,
initialY: 50,
distanceX: -10,
distanceY: 0,
description: 'swipe left',
},
}
name:'Left dodge'
key: 'u',
effect: {
initialX: 50,
initialY: 50,
distanceX: -10,
distanceY: 0,
description: 'swipe left',
},
name:'Left dodge',
description: 'Dodge on the left'
}]
}
```

- #### `activeKeyMappingDebug`

helper to create the config mapping
Expand Down
Loading

0 comments on commit 9376b49

Please sign in to comment.