Jump to content

Introducing ‘Nadion’ - an add-on for Phaser


Recommended Posts

hey everyone, 


I’d like to announce that I’m making some of my work available. I’m calling it ‘Nadion’ (yes, that’s a Star Trek joke - “phasers” in Star Trek emit “nadions”).


Nadion is an add-on to Phaser. It was pulled out of my (in-progress) platformer/scroller game as reusable and extensible elements became obvious. As more work went into these elements I thought that others might benefit from them as well, so I’m putting them up on Github (https://github.com/jcd-as/nadion). (Nadion is provided with the same MIT Open Source license as Phaser).


Primarily, Nadion is a framework for creating game levels in the Tiled map editor (http://www.mapeditor.org). To this end, it provides Trigger, Area, Alarm and Emitter objects which can be added to maps and set-up in Tiled so that they call game code, setting up game logic without needing to write code to do it. It supports multiple layers which can scroll at different rates (“parallax” scrolling), as well as Tiled "image layers" and "object layers" (which map to Groups in Phaser and which contain all your sprites and objects).


Nadion also provides some simple game objects such as a state machine and simple on-screen controls for touch-screen devices, as well as some helper functions that I have found useful; things such as finding a named item in a group or array (see the docs on the Nadion namespace for a complete list).


Plus there are some development-time helpers. You can use a browser query string ('render=canvas') to force canvas rendering. There is a "developer mode" toggle you can set that will set some hotkeys: 'f' will display the frame-rate, 'd' will show some debug info (currently just sprite bounds), 'p' will toggle on/off Particles and the '1' - '5' keys will toggle on/off the drawing of first five tile layers.


Lastly, there is a small sample that shows how to use Nadion in a game. It currently only shows a player sprite able to move around in a level with several "parallax" scrolling tile layers and an image layer, but it gives a starting point and shows how to use the base classes and the state machine. The sample also shows how to use a query string (‘dev=<level_num>’) to enter "developer mode" and start at a particular level (overriding what's saved in local storage), skipping the splash screen. I’m planning on adding a bit more to it soon. Meanwhile, documentation on all the classes is found in the 'docs' directory.


While I tried to make Nadion rather generic, ultimately it was refactored out of a particular style of game (multi-level platformer) and may not be suitable for all purposes. YMMV, but hopefully it will be useful to someone. :)



Link to comment
Share on other sites

I've updated the sample to include a Trigger (SetTileTrigger, to be precise) which is activated on touch and turns a nearby plant into a flower (also plays a sound effect).

it's an ugly pink square (that turns green when activated), because that was already in the tileset graphic :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...