This project has the basics to start building your own library for using in Decentraland scenes.
The libraries in the Awesome Repository are available for all to use. We encourage you to create and share your own as well, we'd love to see the community grow and start sharing more reusable solutions to common problems through libraries!
See Create Libraries for tips on how to design and develop your library, and for simple instructions for publishing it to NPM.
Below is a template to help you craft documentation for your library, so others know how to use it.
dcl-scene-extras includes helpful solutions for populating random characters in a Decentraland scene.
To use any of the helpers provided by this library:
-
Install it as an npm package. Run this command in your scene's project folder:
npm install dcl-scene-extras
-
Add this line at the start of your game.ts file, or any other TypeScript files that require it:
import * as EXTRAS from 'dcl-scene-extras'
//list of all extras created
EXTRAS.extras
let ex = EXTRAS.createExtra({position: new Vector3(8,0,8)}, EXTRAS.EXTRA_BODY_TYPE.MALE, "Bob")
ex.moveExtra(new Vector3(8,0,8), new Vector3(4,0,15), 2, ()=>{})
ex.changeWearables(['urn:decentraland:off-chain:base-avatars:f_stripe_white_pants'])
ex.rotateExtra(Quaternion.Euler(0,0,0), Quaternion.Euler(0,90,0), 2, ()=>{})
ex.triggerEmote('wave')
ex.stopEmote()
...
This scene is protected with a standard Apache 2 licence. See the terms and conditions in the LICENSE file.