Skip to content

Available Components

Jon Bonazza edited this page Apr 4, 2014 · 7 revisions

N2D provides a number of component types. While the list is finite, this doesn't mean that it is necessarily limited. To start, let's take a look at the various components that N2D supports:

Rendering

  • SpriteRenderer - A SpriteRenderer renders a single sprite on the screen. Sprites can be either static images or animated using a key-frame animation. Examples of entities that might be rendered with a SpriteRenderer are a player character, a NPC, world props, loot, etc...
  • TileMapRenderer - A TileMapRenderer renders a tile map. A tile map is just a collection of coordinates, that each map to specific coordinates in an image. Tile maps are used to render things like envrionments, or backgrounds, where the images would be too large to render as a single image.

Audio

  • MusicSource - A MusicSource component handles the playback of game music. MusicSource components will stream the music from disk. That is, instead of loading the entire file into memory, it will load it in chunks and play it back as it loads each chunk. This is meant to be used for large, lengthy audio tracks, as it is slower, but saves memory.
  • SoundEffectSource - A SoundEffectSource component handles the playback of game sfx, such as sword slashing, player jumping, enemy dying, etc... SoundEffectSource components are sampled from disk. That is, when the scene is loaded, the entire sound file is loaded into memory. This is to be used for short audio tracks, as playback is much faster. if you tried to sample a large file, would take up a lot of memory.

Physics

The physics system design is still being tweaked, but will ultimately make use of Box2D for rigidbody physics.

Networking

N2D will provide networking APIs, but the specifics have yet to be determined.

Custom game logic

Aside from the above components that have predefined functionality, N2D also provides a more abstract and extensible component called Behavior. This component uses user-created javascript files to provide its functionality. Behavior components are used to provide game specific logic to your GameObjects. See the section on Scripting for more information.

Clone this wiki locally