Skip to content

Examples

Daniel Báez edited this page Apr 12, 2025 · 6 revisions

Running pnpm dev starts a dev server, the KAPLAY Dev Mode

image

We can highlight two types of files

  • Examples The ones in /examples folder, that are user suitable demos for learning/showcasing features in KAPLAY.

  • Playtests They are inside the /tests/playtests/ folder. Their utility is being the examples that devs will use for testing. Usually tests that needs any interaction or renderization.

Creating new files and refreshing will update the list.

Creating examples

For creating new examples, you should follow the metadata. It should be in the top of the file, and should follow the following format:

/**
 * @file Example Title
 * @description Example Description
 * @difficulty 0
 * @tags gobj
 * @minver 3001.0
 * @locked
 */
  • @file: The example name
  • @description: The example description, without final dot
  • @difficulty: Level of difficulty, 0 easy, 1 medium, 2 hard, 3 auto (used for playtests)
  • @tags: The example tags, separated by comma. Avaible tags:
    • basics: Suitable for all kaplayers
    • gobj: GameObjRaw related
    • comps: components related
    • debug: debug related
    • audio: sound related
    • input: input related
    • draw: draw related
    • text: text related
    • ai: enemies/npc AI related
    • animation: animation related
    • math: math related

Example view

When you click one of the files, you can inspect that file running with the local version of KAPLAY. Dev mode rebuild KAPLAY every time you make a change in the source.

For refreshing example (after KAPLAY rebuilt or example edited) press F5 or refresh with your navigator buttons.

image

Clone this wiki locally