use bevy::prelude::*; #[cfg(feature = "bevy-inspector-egui")] use bevy_inspector_egui::quick::WorldInspectorPlugin; use bevy_parallax::{ CameraFollow, CreateParallaxEvent, LayerData, LayerRepeat, LayerSpeed, Limit, ParallaxCameraComponent, ParallaxPlugin, ParallaxSystems, RepeatStrategy, Vec2Limit, PID, }; #[derive(Component)] pub struct Player { lin_speed: f32, ang_speed: f32, } impl Default for Player { fn default() -> Self { Self { lin_speed: 900., ang_speed: 3., } } } fn main() { // Define window let primary_window = Window { title: "Cyberpunk".to_string(), resolution: (1280.0, 720.0).into(), resizable: false, ..default() }; let mut app = App::new(); app.add_plugins( DefaultPlugins .set(WindowPlugin { primary_window: Some(primary_window), ..default() }) // Use nearest filtering so our pixel art renders clear .set(ImagePlugin::default_nearest()), ) .add_plugins(ParallaxPlugin) .add_systems(Startup, initialize_camera_system) .add_systems(Update, move_player_system.before(ParallaxSystems)) .insert_resource(ClearColor(Color::srgb_u8(42, 0, 63))); #[cfg(feature = "bevy-inspector-egui")] app.add_plugins(WorldInspectorPlugin::new()); app.run(); } pub fn move_player_system(keyboard_input: Res>, time: Res