diff --git a/assets/black-square.png b/assets/black-square.png
deleted file mode 100644
index bf15580..0000000
Binary files a/assets/black-square.png and /dev/null differ
diff --git a/assets/player/player.png b/assets/player/player.png
new file mode 100644
index 0000000..c315bbd
Binary files /dev/null and b/assets/player/player.png differ
diff --git a/assets/player/player.svg b/assets/player/player.svg
new file mode 100644
index 0000000..588bbde
--- /dev/null
+++ b/assets/player/player.svg
@@ -0,0 +1,68 @@
+
+
+
+
diff --git a/src/main.rs b/src/main.rs
index 0aee83f..d97a60b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -49,10 +49,11 @@ fn main() {
.init_resource::()
.init_resource::()
.add_systems(Startup, (setup, setup_ui))
- .add_systems(Update, render_ui)
+ .add_systems(Update, (render_ui, movement))
.run();
}
+// Define UI resources
#[derive(Default, Resource)]
struct UiState {
username: String,
@@ -64,6 +65,13 @@ struct OpenWindows {
login_open: bool,
}
+// Define the player component
+#[derive(Component)]
+struct Player {
+ movement_speed: f32,
+ rotation_speed: f32,
+}
+
// Bevy engine setup
fn setup(mut commands: Commands, asset_server: Res) {
commands.spawn(Camera2dBundle {
@@ -76,10 +84,13 @@ fn setup(mut commands: Commands, asset_server: Res) {
});
commands.spawn((
SpriteBundle {
- texture: asset_server.load("black-square.png"),
- transform: Transform::from_xyz(100., 0., 0.),
+ texture: asset_server.load("player/player.png"),
..default()
- }
+ },
+ Player {
+ movement_speed: 1024.,
+ rotation_speed: f32::to_radians(360.),
+ },
));
}
@@ -99,13 +110,72 @@ fn setup_ui(mut contexts: EguiContexts) {
contexts.ctx_mut().set_fonts(fonts);
}
+// Define the player movement system
+fn movement(
+ time: Res