Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4532100000 |
+23
-3
@@ -1,9 +1,29 @@
|
|||||||
use bevy::{prelude::*};
|
use bevy::prelude::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
println!("Hello, world!");
|
||||||
|
|
||||||
App::new()
|
App::new()
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
.run();
|
.add_systems(Startup, setup)
|
||||||
|
.add_systems(Update, moveng)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Component)]
|
||||||
|
struct Move;
|
||||||
|
|
||||||
|
fn setup(mut commands: Commands, assets: Res<AssetServer>) {
|
||||||
|
commands.spawn(Camera2d);
|
||||||
|
commands.spawn((
|
||||||
|
Sprite::from_image(assets.load("02-00.png")),
|
||||||
|
Transform::from_scale(Vec3::splat(0.1)),
|
||||||
|
Move,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
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