use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
.add_startup_system(spawn_warrior)
.run();
}
fn spawn_warrior(
mut commands: Commands,
asset_server: ResMut<AssetServer>,
mut texture_atlases: ResMut<Assets<TextureAtlas>>,
) {
let texture_handle = asset_server.load("warrior_idle_front.png");
let texture_atlas =
TextureAtlas::from_grid(texture_handle, Vec2::new(32.0, 32.0), 1, 1, None, None);
let texture_atlas_handle = texture_atlases.add(texture_atlas);
// Use only the subset of sprites in the sheet that make up the run animation
commands.spawn(Camera2dBundle::default());
commands.spawn((SpriteSheetBundle {
texture_atlas: texture_atlas_handle,
sprite: TextureAtlasSprite::new(0),
transform: Transform::from_scale(Vec3::splat(6.0)),
..default()
},));
}