Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4532100000 |
+12
-19
@@ -1,36 +1,29 @@
|
||||
use bevy::{prelude::*};
|
||||
use bevy::prelude::*;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
|
||||
App::new()
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, moveng)
|
||||
.run();
|
||||
.add_plugins(DefaultPlugins)
|
||||
.add_systems(Startup, setup)
|
||||
.add_systems(Update, moveng)
|
||||
.run();
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
struct Move;
|
||||
|
||||
fn setup(mut commands: Commands, assets: Res<AssetServer>){
|
||||
commands.spawn((Camera2d, Move));
|
||||
|
||||
fn setup(mut commands: Commands, assets: Res<AssetServer>) {
|
||||
commands.spawn(Camera2d);
|
||||
commands.spawn((
|
||||
Sprite::from_image(assets.load("002.png")),
|
||||
Transform::from_scale(Vec3::splat(0.25)),
|
||||
Sprite::from_image(assets.load("02-00.png")),
|
||||
Transform::from_scale(Vec3::splat(0.1)),
|
||||
Move,
|
||||
));
|
||||
|
||||
commands.spawn((
|
||||
Sprite::from_image(assets.load("000.png")),
|
||||
Transform::from_xyz(0.0, 0.0, -1.)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
fn moveng(mut m_sprite: Query<(&mut Transform, &Move)>){
|
||||
for (mut tr, _) in m_sprite {
|
||||
tr.translation.x += 0.5;
|
||||
fn moveng(mut m_srite: Query<(&mut Transform, &Move)>) {
|
||||
for (mut tr, _) in m_srite {
|
||||
tr.translation.x += 0.1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user