From a15e392b8b61a14a84d65b587306c9f59be14ed9 Mon Sep 17 00:00:00 2001 From: Saverio Miroddi Date: Tue, 2 Aug 2022 22:21:49 +0200 Subject: [PATCH] Update the player movement clamper by using Bevy's SystemParam Still not a good design, but SystemParam is much better than a helper system. --- src/attack.rs | 20 +---- src/movement.rs | 197 +++++++++++++++++++++++------------------------- 2 files changed, 97 insertions(+), 120 deletions(-) diff --git a/src/attack.rs b/src/attack.rs index 1ed2a661..2901e4d9 100644 --- a/src/attack.rs +++ b/src/attack.rs @@ -23,13 +23,10 @@ use crate::{ self, ATTACK_HEIGHT, ATTACK_LAYER, ATTACK_WIDTH, ITEM_BOTTLE_NAME, ITEM_HEIGHT, ITEM_LAYER, ITEM_WIDTH, THROW_ITEM_ROTATION_SPEED, }, - enemy::SpawnLocationX, input::PlayerAction, item::item_carried_by_player, - metadata::{FighterMeta, GameMeta, ItemMeta, LevelMeta}, - movement::{ - clamp_player_movements, LeftMovementBoundary, MoveInArc, MoveInDirection, Rotate, Target, - }, + metadata::{FighterMeta, ItemMeta}, + movement::{MoveInArc, MoveInDirection, PlayerMovementClamper, Rotate, Target}, state::State, ArrivedEvent, Enemy, GameState, Player, Stats, }; @@ -298,12 +295,9 @@ fn player_flop( ), With, >, - enemy_spawn_locations_query: Query<&SpawnLocationX>, - level_meta: Res, + player_movement_clamper: PlayerMovementClamper, fighter_assets: Res>, time: Res