phichain-assets
Thephichain-assets crate manages game assets including note sprites, line textures, hit effects, and audio resources for the Phichain game engine.
Installation
Add this to yourCargo.toml:
Dependencies
The crate depends on:bevy0.16.1 (for asset loading and management)bevy_asset_loader0.23.0-rc.4 (for declarative asset loading)bevy_kira_audio0.23.0 (for audio assets)bevy_egui0.35.1 (optional, for editor integration)
Core Plugin
The main asset management plugin.
Asset Collections
ImageAssets
Collection of all image assets used in the game.
Available Image Assets
Available Image Assets
Note Sprites:
tap- Tap note imagedrag- Drag note imagehold- Hold note body imagehold_head- Hold note head imagehold_tail- Hold note tail imageflick- Flick note image
tap_highlight- Highlighted tap notedrag_highlight- Highlighted drag notehold_highlight- Highlighted hold bodyhold_head_highlight- Highlighted hold headflick_highlight- Highlighted flick note
line- Judgment line texturehit- Hit effect sprite
AudioAssets
Collection of audio assets for hit sounds and effects.
Available Audio Assets
Available Audio Assets
click- Click/tap sound effect (OGG format)drag- Drag sound effect (OGG format)flick- Flick sound effect (OGG format)metronome- Metronome tick sound (WAV format)
Asset Setup
Configure the Bevy asset root directory.This function sets the
BEVY_ASSET_ROOT environment variable:- In debug builds: Uses the project root directory
- In release builds: Uses the executable’s parent directory
- Can be overridden with
PHICHAIN_ASSET_ROOTenvironment variable
Asset Directory Structure
Assets should be organized in the following structure:Complete Examples
Egui Integration
When using theegui feature, assets are automatically loaded into egui contexts:
Asset Loading States
Assets are loaded asynchronously. Check if assets are ready:Custom Assets
Extend the asset system with custom resources:Troubleshooting
Assets Not Loading
Assets Not Loading
- Ensure
setup_assets()is called before creating the App - Verify the
assets/directory exists in the correct location - Check file names match exactly (case-sensitive)
- Verify image formats are supported (PNG recommended)
- Check console for asset loading errors
Custom Asset Root
Custom Asset Root
Set the
PHICHAIN_ASSET_ROOT environment variable:See Also
- phichain-game - Game engine using these assets
- Bevy Asset System - Bevy asset documentation
- bevy_asset_loader - Asset loader library