Skip to content

Latest commit

 

History

History
26 lines (21 loc) · 2.02 KB

3-Usage.md

File metadata and controls

26 lines (21 loc) · 2.02 KB

Usage Guide

General Info

This is a set of functions, macros, assets, and other necessary plumbing for creating avatars in your game. You can have the user create and customize their own avatar, create and use static avatars (such as for NPCs), and even create randomized avatars (JavaScript API only for now; macro implementation coming soon).

Every avatar has an ID, which is a unique name you'll use to access, display, save, edit, or alter them. Avatar IDs can be any string, but I recommend using something that follows the same rules as an HTML/CSS id; that is, don't start with a number, and use dashes or underscores instead of sapces.

What ID an avatar has is determined by:

  • For player-created avatars, you assign the ID with the <<avatarmaker>> macro.
  • For an avatar passage, the name of the passage is the avatar's ID.
  • When you create an avatar via the JavaScript API, one of the arguments you pass to the Noble.Character constructor or Noble.Character.add() method will be an ID.

Quick Overview

  • Macros.
    • <<pt avatarID [options]>>: creates and shows a portrait.
    • <<ptlink avatarID [options]>><</ptlink>>: creates and shows a clickable portrait; used like a <<link>> macro.
    • <<avatarmaker avatarID passageName [debug]>>: shows an avatar editor to the user, so they can make their own custom avatar.
  • JavaScript API
    • window.Noble: the global namespace for all the APIs and options.
    • Noble.config: the configuration options are stored (and edited) here.
    • Noble.components: where the relative urls to components (the individual options) are stored.
    • Noble.slots: this interface is primarily for creating custom and random characters.
    • Noble.Character: this constructor turns an object into an avatar object.
    • Noble.Portrait: this constructor builds a jQuery-wrapped output element from Noble.Character instances.
    • Noble.editor: this interface handles all the editor functionality.