Skip to content
Nate River edited this page Nov 21, 2024 · 29 revisions

Welcome to the PixelHeroesHub wiki! Are you looking for FAQ? More detailed documentation will appear soon.

How to use

To start using our asset, download and import it with Package Manager, then open CharacterEditor scene and press Play. You can build customized characters and then save them as PNG sprite sheets. You can use sprite sheets with Unity or other game engines.

Animation

We use SpriteLibrary and SpriteResolver from Unity's 2D Animation package to swap sprites, you can refer to Unity website to learn more. You will find animation clips inside PixelHeroes/Common/Animation/Character folder.

Character controls

Please refer to Example scripts to learn more about implementing character controls.

Building characters at runtime (on the fly)

Our asset can generate temporary runtime sprite sheets and Sprite Library Asset. All you need to do is:

  • Navigate to CharacterBuilder component attached to a character
  • Set string equipment names for each layer (the pattern can be in simple format NAME or advanced format NAME#FFFFFF/H:S:V with color and HSV offset, Hue shoud be from -180 to 180, Saturation and Brightness shoud be from -100 to 100)
  • Press Rebuild on the component

You can do this both from Inspector or from code.

Sprite effects (dust, fire muzzle and other)

When character runs on jumps, you can play dust effects based on sprite sheets. You will find animation clips for effects inside Common/Animation/SpriteEffect folder. Refer to CreateSpriteEffect method of 'EffectManager' scriptable object to learn how to create sprite effects. When creating fire muzzles, you can use Character.Firearm.FireMuzzlePosition to get the offset or Character.Firearm.FireMuzzle transform.

Firearms

When making a game with Unity, you may want to additionally rotate a firearm, or implement shooting/recoil animation from any animation state (for example when jumping or crouching). This is possible with Detached firearm, when it has a separate Sprite Renderer that you can fully control (it's not baked to the main sprite sheet). If you want to use sprite sheets only, or if you use another game engine, you should use Attached firearms that are merged with the main sprite sheet. To switch firearm modes use Detached Firearm toggle on the main Character script.