bevymod2d_hierarchy

crates.io MIT/Apache 2.0 crates.io

Bevy plugin for more ergonomic 2D.

Usage

Add the dependency to your Cargo.toml toml [dependencies] bevy_mod_2d_hierarchy = "0.3"

Add the plugin to your Bevy App: ```rust use bevy::prelude::; use bevy_mod_2d_hierarachy::prelude::;

fn main() { App::new() .addplugins(DefaultPlugins) .addplugin(Transform2dPlugin) // .. rest of systems etc .run(); } ```

Then spawn some sprites

rust pub fn spawn( mut commands: Commands, asset_server: Res<AssetServer>, ) { commands.spawn(Camera2dBundle2::default()); commands.spawn(SpriteBundle2 { texture: asset_server.load("sprite.png"), transform2: Transform2::from_rotation(0.5 * PI).with_scale(3.), ..Default::default() }) .with_children(|builder| { builder.spawn(SpriteBundle2 { sprite: Sprite { color: Color::YELLOW, ..Default::default() }, texture: asset_server.load("sprite.png"), transform2: Transform2::from_xy(0., 32.), propagate: Propagate::TRANSLATION, ..Default::default() }); }); }

Notes

See also: https://github.com/devil-ira/bevymodtransform2d.

Major differences Transform2d vs 2d_hierarchy:

You could even use Transform2d and 2d_hierarchy together if you really wanted. That would be really silly though.