// In this program, anchors are demonstrated use bevy::prelude::*; use seldom_pixel::prelude::*; fn main() { App::new() .add_plugins(( DefaultPlugins.set(WindowPlugin { primary_window: Some(Window { resolution: Vec2::splat(512.).into(), ..default() }), ..default() }), PxPlugin::::new(UVec2::splat(32), "palette/palette_1.png".into()), )) .insert_resource(ClearColor(Color::BLACK)) .add_systems(Startup, init) .run(); } fn init(mut commands: Commands, mut sprites: PxAssets) { commands.spawn(Camera2dBundle::default()); // Centered commands.spawn(PxSpriteBundle:: { sprite: sprites.load("sprite/mage.png"), position: IVec2::new(8, 16).into(), ..default() }); // Bottom Left commands.spawn(PxSpriteBundle:: { sprite: sprites.load("sprite/mage.png"), position: IVec2::splat(16).into(), anchor: PxAnchor::BottomLeft, ..default() }); // Custom. Values range from 0 to 1, with the origin at the bottom left corner. commands.spawn(PxSpriteBundle:: { sprite: sprites.load("sprite/mage.png"), position: IVec2::new(24, 16).into(), anchor: Vec2::new(0.2, 0.8).into(), ..default() }); } #[px_layer] struct Layer;