script-node-basic-scripts-project.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. .. include:: ../_header.rst
  2. The Basic Scripts project
  3. ~~~~~~~~~~~~~~~~~~~~~~~~~
  4. In the previous section, we covered how to create the ``ScriptNode`` class. It is very basic, it is the minimum you need for using the |ScriptNodes|_. For that reason, we created a project with other basic script nodes you can use in your game: the `script-nodes-basic <http://github.com/PhaserEditor2D/script-nodes-basic>`_ project.
  5. It is a project in development. In the way we get more experience making games with the script nodes, we may change it or increment the number of scripts on it.
  6. Following we present you a summary of the project. You can learn more on the project's site:
  7. `github.com/PhaserEditor2D/script-nodes-basic <https://github.com/PhaserEditor2D/script-nodes-basic>`_
  8. There are three groups of scripts: **Base**, **Triggers**, and **Actions**.
  9. Base scripts
  10. ''''''''''''
  11. Contain basic/abstract functionality. Often, you will create prefab variants of them (extend them).
  12. * **ScriptNode** - the base class for all the scripts.
  13. * **SpriteScriptNode** - base prefab for script nodes accessing sprite objects.
  14. * **RootScriptNode** - a script node that registers itself into the game object and can be used as a container of other scripts.
  15. Trigger scripts
  16. '''''''''''''''
  17. These scripts listen to a certain event. When the event is triggered, then execute the children, which are actions.
  18. * **OnEventScript** - listens the given ``eventName`` object's event.
  19. * **OnKeyboardEventScript** - listens the given ``eventName`` keyboard's event.
  20. * **OnPointerDownScript** - a prefab variant of **OnEventScript**, listening the ``pointerdown`` event.
  21. * **OnSceneAwakeScript** - listens the ``scene-awake`` event of the scene.
  22. Action scripts
  23. ''''''''''''''
  24. Actions are scripts that are executed manually or by other nodes, like triggers or other actions.
  25. * **CallbackActionScript** - executes the given ``callback`` expression.
  26. * **StartSceneActionScript** - starts the given ``sceneKey`` scene.
  27. * **ExecActionScript** - executes the given ``targetAction``.