From 22a8c91c5e389457e8302ea5d5ad143e4342c6ab Mon Sep 17 00:00:00 2001 From: Franklin Date: Wed, 8 Nov 2023 14:45:04 -0400 Subject: [PATCH] Added muzzle flash light --- src/comps/core/markers/mod.rs | 1 + src/comps/core/markers/muzzle_flash.rs | 4 ++++ src/comps/guns/m4a1.rs | 1 - src/comps/guns/mod.rs | 1 - src/logic/core/guns/despawn_shots.rs | 12 +++++++++++ src/logic/core/guns/mod.rs | 4 +++- src/logic/core/guns/shoot.rs | 30 ++++++++++++++++++++++++++ src/logic/core/player/hands.rs | 11 ++++++---- src/scenes/scene1/init.rs | 5 +++-- src/ui/game/fps_counter.rs | 2 +- 10 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 src/comps/core/markers/muzzle_flash.rs delete mode 100644 src/comps/guns/m4a1.rs create mode 100644 src/logic/core/guns/despawn_shots.rs create mode 100644 src/logic/core/guns/shoot.rs diff --git a/src/comps/core/markers/mod.rs b/src/comps/core/markers/mod.rs index 6622ab1..90ffc00 100644 --- a/src/comps/core/markers/mod.rs +++ b/src/comps/core/markers/mod.rs @@ -2,3 +2,4 @@ pub mod camera; pub mod firearm; pub mod holdable; pub mod player; +pub mod muzzle_flash; \ No newline at end of file diff --git a/src/comps/core/markers/muzzle_flash.rs b/src/comps/core/markers/muzzle_flash.rs new file mode 100644 index 0000000..a593a01 --- /dev/null +++ b/src/comps/core/markers/muzzle_flash.rs @@ -0,0 +1,4 @@ +use bevy::{prelude::Component, time::Timer}; + +#[derive(Component)] +pub struct MuzzleFlashMarker(pub Timer); \ No newline at end of file diff --git a/src/comps/guns/m4a1.rs b/src/comps/guns/m4a1.rs deleted file mode 100644 index 8b13789..0000000 --- a/src/comps/guns/m4a1.rs +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/comps/guns/mod.rs b/src/comps/guns/mod.rs index 1291f9b..e69de29 100644 --- a/src/comps/guns/mod.rs +++ b/src/comps/guns/mod.rs @@ -1 +0,0 @@ -pub mod m4a1; diff --git a/src/logic/core/guns/despawn_shots.rs b/src/logic/core/guns/despawn_shots.rs new file mode 100644 index 0000000..7e242af --- /dev/null +++ b/src/logic/core/guns/despawn_shots.rs @@ -0,0 +1,12 @@ +use bevy::prelude::*; + +use crate::comps::core::markers::muzzle_flash::MuzzleFlashMarker; + +pub fn despawn_muzzle_flashes(mut commands: Commands, mut query: Query<(&mut MuzzleFlashMarker, Entity)>, time: Res