Skip to content

Commit

Permalink
Landmark Update: Merge branch 'feature-landmark' into develop
Browse files Browse the repository at this point in the history
* feature-landmark:
  freeze player in dialog
  refactor  and optimizeinteractionEvent
  spawn mult Fabiens and limit Chaser to their Zone
  force Direction for certain landmarks
  spawn a lot more Landmarks, fix npcs' movement, minor bug fixes
  refactor Landmark occupation, globalize Spritesheet Indice
  add updates to the `CHANGELOG`
  rename `PlayerLocation` to `Location`
  • Loading branch information
Wabtey committed Sep 21, 2023
2 parents 94b8d8b + 2f9b1c4 commit 956671a
Show file tree
Hide file tree
Showing 26 changed files with 1,935 additions and 979 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Dialog Update - [v0.4.0](https://github.com/Fabinistere/fabien-et-la-trahison-de-olf/releases/tag/v0.4.0) - 2023-09-04

### Changed

- globalize `PlayerLocation` to `Location`
- The component `Location` is given to
- Each npc
- Each landmark
- `Location` is still a `State` to keep the quick and easy access to the player's location

### Dialog

- YML Dialog and reorganize ui components

### NPCs' Behavior

#### Refactored

- Follow Behavior
- add and use a `FollowRangeSensor` to detect the follow_target's hitbox

#### Added

- Detection Behavior
- `TargetSeeker`
- `DetectionRangeSensor` used to analyze all entering characters' hitbox and compare with their `TargetType`
- if it correpond: Deactivate this sensor and start the Chase Behavior with the component `Chaser`.
- Chase Behavior
- `Chaser`
- `PursuitRangeSensor` used to analyze all exiting characters' hitbox and compare with their `Chaser`'s `target`
- if it correpond: Deactivate this sensor and remove the Chase Behavior.
- The `CharacterCloseSensor` used to detect all entering `Chaser`s hitbox and start a Combat if the `Chaser`'s `target` is the parent of the `CharacterCloseSensor`.

## Map, Title Screen and Animation Update - [v0.3.9](https://github.com/Fabinistere/fabien-et-la-trahison-de-olf/releases/tag/v0.3.9) - 2023-08-31

[![v0.3.9](https://img.shields.io/badge/v0.3.9-gray?style=flat&logo=github&logoColor=181717&link=https://github.com/Fabinistere/fabien-et-la-trahison-de-olf/releases/tag/v0.3.9)](https://github.com/Fabinistere/fabien-et-la-trahison-de-olf/releases/tag/v0.3.9)
Expand Down
39 changes: 38 additions & 1 deletion src/animations/mod.rs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@ use bevy::prelude::*;
pub use fade::{Fade, FadeType};
pub use slide::{Slide, UiSlide, UiSlideType};

use crate::in_menu;
use crate::{
constants::character::{
COLUMN_FRAME_IDLE_END, COLUMN_FRAME_IDLE_START, COLUMN_FRAME_RUN_END,
SPRITESHEET_COLUMN_NUMBER, SPRITESHEET_LINE_NUMBER,
},
in_menu,
};

use self::sprite_sheet_animation::CharacterState;

// DOC: create systemsLabel for `sprite_sheet_animation::tempo_animation_timer`

Expand All @@ -16,6 +24,7 @@ pub struct AnimationPlugin;
impl Plugin for AnimationPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<CharacterSpriteSheet>()
.init_resource::<GlobalAnimationIndices>()
.add_systems(
PostUpdate,
(
Expand Down Expand Up @@ -68,3 +77,31 @@ impl FromWorld for CharacterSpriteSheet {
}
}
}

#[derive(Deref, Clone, Resource)]
pub struct GlobalAnimationIndices(Vec<Vec<(usize, usize, CharacterState)>>);

impl FromWorld for GlobalAnimationIndices {
fn from_world(_world: &mut World) -> Self {
let mut global_animations_indices: Vec<Vec<(usize, usize, CharacterState)>> = Vec::new();
for line in 0..SPRITESHEET_LINE_NUMBER {
global_animations_indices.push(vec![
// Run Indexes for each line
(
line * SPRITESHEET_COLUMN_NUMBER,
line * SPRITESHEET_COLUMN_NUMBER + COLUMN_FRAME_RUN_END,
CharacterState::Idle,
// CharacterState::Run, ?
),
// Idle Indexes for each line
(
line * SPRITESHEET_COLUMN_NUMBER + COLUMN_FRAME_IDLE_START,
line * SPRITESHEET_COLUMN_NUMBER + COLUMN_FRAME_IDLE_END,
CharacterState::Idle,
),
]);
}

GlobalAnimationIndices(global_animations_indices)
}
}
14 changes: 11 additions & 3 deletions src/characters/npcs/idle.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use bevy::prelude::*;
use bevy_rapier2d::prelude::Velocity;

use super::{movement::NPCBehavior, NPC};

Expand All @@ -11,12 +12,19 @@ pub struct RestTime {
pub fn flexing_timer(
mut commands: Commands,
time: Res<Time>,
mut npc_query: Query<(Entity, &mut RestTime, &Name), (With<NPC>, With<NPCBehavior>)>,
mut npc_query: Query<
(Entity, &mut RestTime, &mut Velocity, &Name),
(With<NPC>, With<NPCBehavior>),
>,
) {
for (npc, mut rest_timer, name) in npc_query.iter_mut() {
for (npc, mut rest_timer, mut rb_vel, _name) in npc_query.iter_mut() {
rest_timer.timer.tick(time.delta());

rb_vel.linvel.x = 0.;
rb_vel.linvel.y = 0.;
// info!("{:#?}", rest_timer.timer);
if rest_timer.timer.finished() {
info!(target: "Stop Rest", "{:?}, {}", npc, name);
// info!(target: "Stop Rest", "{:?}, {}", npc, _name);

// restart previous behavior
commands.entity(npc).remove::<RestTime>();
Expand Down
Loading

0 comments on commit 956671a

Please sign in to comment.