phaserjs / phaser-ce-examples

Contains hundreds of source code examples and related media for the Phaser HTML5 Game Framework.

Home Page:http://phaser.io/examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add a method of encoding "instructions" and other metadata

pnstickne opened this issue · comments

Many of the examples don't have any instructions.
Some of the examples have embedded (ie. Text) instructions.

It would be beneficial be able to specify metadata (immediately: instructions) that could be uniformly displayed along with the example being run. Simple prose-instruction metadata string could also describe the expected behavior.

In addition to being a nice way to uniformly codify and display such useful information it would also allow some examples to be made simpler.

Example git-friendly approaches:

  • Separate some_example.json file
  • Comment-embedded extraction (I like this because it's "in with" the example itself)

Future metadata might include the minimum Phaser version or Plugin required.

It seems like this could be done (and keeping in line with the current joystick, eg. examples) with jsdoc-style comments at the top.

However the @overview tag should probably be used instead of @description as the former is an alias for / implies @file while the latter would be 'associated' the following type.

Being a little liberal with the @requires tag can be used to for annotating required plugins or minimum phaser versions.

eg.

  /**
  * @overview
  * Connects a series of Box2D gears together.
  *
  * Drag or spin the green blocks ("gears") to affect the connected sprites.
  *
  * @requires Phaser>=2.1.0
  * @requires Box2d-plugin
  */

These can of course be parsed to display descriptions in the HTML itself (or on the gallery list, etc) as well as to aide/limit version selection.

Could also create new tags, such as @tags to enable better gather of meta-data/searching.