diff --git a/.idea/csv-editor.xml b/.idea/csv-editor.xml new file mode 100644 index 0000000..4fc2c12 --- /dev/null +++ b/.idea/csv-editor.xml @@ -0,0 +1,16 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 2507410..ac4d1a8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -412,6 +412,15 @@ dependencies = [ "bevy_internal 0.15.0", ] +[[package]] +name = "bevy-parallax" +version = "0.11.0" +source = "git+https://github.com/foxzool/bevy-parallax.git?rev=0322b9d#0322b9d75160b6d2c5d858eaebcd2e416e446909" +dependencies = [ + "bevy 0.15.0", + "serde", +] + [[package]] name = "bevy_a11y" version = "0.14.2" @@ -5186,6 +5195,7 @@ name = "skywalker2088" version = "0.1.3" dependencies = [ "bevy 0.15.0", + "bevy-parallax", "bevy_asset_loader", "bevy_kira_audio", "bevy_pkv", diff --git a/Cargo.toml b/Cargo.toml index 11d2fc2..49f9e3d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ bevy_asset_loader = { version = "0.22.0", features = [ ] } bevy_kira_audio = { version = "0.21.0", features = ["ogg","mp3", "wav"] } rand = "0.9.0-alpha.2" -#bevy-parallax = "0.10.0" +bevy-parallax = { git = "https://github.com/foxzool/bevy-parallax.git", rev = "0322b9d" } bevy_prototype_lyon = "0.13.0" serde = "1.0.210" serde_json = "1.0.128" diff --git a/src/components/player.rs b/src/components/player.rs index 4056af6..115fa71 100644 --- a/src/components/player.rs +++ b/src/components/player.rs @@ -1,5 +1,6 @@ use crate::components::character::{Character, CharacterType}; use crate::components::spawnable::SpawnPosition; +use crate::gameplay::player::PlayerComponent; use bevy::prelude::{Bundle, Component, Deref, DerefMut, Resource, Vec2}; /// Parameters for how to spawn new players. By default, the player can do anything. @@ -30,7 +31,7 @@ pub struct PlayerData { } /// Input method for a player -/// Gamepad has a usize identifier +/// Gamepad has an usize identifier #[derive(Clone, PartialEq, Debug, Copy)] pub enum PlayerInput { Keyboard, @@ -146,7 +147,7 @@ pub struct PlayerOutgoingDamageComponent { pub projectile_size: f32, /// Base projectile count pub projectile_count: usize, - /// Starting cooldown multiplier of the player. Used in calculating the the `cooldown_multiplier` + /// Starting cooldown multiplier of the player. Used in calculating the `cooldown_multiplier` pub base_cooldown_multiplier: f32, /// Multiplier for how long abilities take to be ready for use again pub cooldown_multiplier: f32, @@ -172,10 +173,6 @@ pub struct PlayerInventoryComponent { pub money: usize, } -/// Flag for Player Entities -#[derive(Component)] -pub struct PlayerComponent; - impl From<&Character> for PlayerMovementComponent { fn from(character: &Character) -> Self { Self { diff --git a/src/gameplay/camera.rs b/src/gameplay/camera.rs new file mode 100644 index 0000000..8b07d7b --- /dev/null +++ b/src/gameplay/camera.rs @@ -0,0 +1,42 @@ +use crate::ship::engine::Engine; +use crate::util::Math; +use crate::{CameraShake, MainCamera}; +use bevy::prelude::*; +use bevy_parallax::ParallaxMoveEvent; +use crate::gameplay::player::PlayerComponent; + +pub fn camera_follow( + time: Res