Skip to content

Commit

Permalink
Update docs to fix compile bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xShadowBlade authored Apr 29, 2024
1 parent 92ec991 commit c6db564
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@ coins.static.buyUpgrade("upg1Coins");
// Hotkeys
coinGame.keyManager.addKey([
{
id: "gainCoins",
name: "Gain Coins",
key: "g",
onDownContinuous: () => coins.static.gain(),
},
{
id: "buyUpgrades",
name: "Buy Upgrades",
key: "b",
onDownContinuous: () => coins.static.buyUpgrade("upg1Coins"),
Expand Down
16 changes: 13 additions & 3 deletions documentation/docs/game/keyManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@ import { myGame } from "./game.js";

const keyManager = myGame.keyManager;

// Add a key binding
// Add a key binding (not recommeneded)
keyManager.addKey("Move Up", "w", () => player.velocity.y += player.acceleration.y);

// Add multiple key bindings
keyManager.addKeys([
{ id: "moveUp", name: "Move Up", key: "w", onDownContinuous: () => player.velocity.y += player.acceleration.y },
{ id: "moveUp", name: "Move Down", key: "s", onDownContinuous: () => player.velocity.y -= player.acceleration.y },
{
id: "moveUp", // Required
name: "Move Up", // Optional
key: "w", // Key to press (required)
onDownContinuous: () => player.velocity.y += player.acceleration.y,
},
{
id: "moveUp",
name: "Move Down",
key: "s",
onDownContinuous: () => player.velocity.y -= player.acceleration.y,
},
// Add more key bindings here...
]);
```
1 change: 1 addition & 0 deletions typedoc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"exclude": [
"**/node_modules/**",
"**/test/**",
"examples/**",
"src/classes/skillTree.ts",
"src/index.ts",
"src/game/index.ts",
Expand Down

0 comments on commit c6db564

Please sign in to comment.