Take the player up one level
============================

Description
-----------

Press the Enter key, and the character gains an extra level. His Max Hp increases.

You can use `player.recoveryAll()` to restore HP to max.

Structure
---------

*   main
    *   [maps](https://github.com/rpgjs/prebuilt/tree/master/maps/base)
    *   [characters](https://github.com/rpgjs/prebuilt/tree/master/spritesheets/characters/base)
    *   [player.ts](#playerts)
*   [rpg.toml](https://github.com/rpgjs/prebuilt/blob/master/config/rpg.toml)

Files
-----

### player.ts

    import { RpgPlayer, type RpgPlayerHooks, Control, Components } from '@rpgjs/server'
    
    const player: RpgPlayerHooks = {
        onConnected(player: RpgPlayer) {
           player.setComponentsTop(Components.hpBar())
        },
        onInput(player: RpgPlayer, { input }) {
            if (input === Control.Action) {
                console.log('Level Up')
                player.level += 1
            }
        }
    }
    
    export default player

Accessibility guide for tree Tree Example.

Navigate the tree with the arrow keys. Common tree hotkeys apply. Further keybindings are available:

  • enter to execute primary action on focused item
  • f2 to start renaming the focused item
  • escape to abort renaming an item
  • control+d to start dragging selected items

Take the player up one level

Press the Enter key, and the character gains an extra level. His Max Hp increases.

You can use player.recoveryAll() to restore HP to max.