diff options
| author | troido <troido@protonmail.com> | 2020-02-03 16:36:52 +0100 |
|---|---|---|
| committer | troido <troido@protonmail.com> | 2020-02-03 16:36:52 +0100 |
| commit | 19ce5319e2250b7b0e1a188f69d24de282a85a7f (patch) | |
| tree | 2e51064f5e1dfa82304c558c56ab907255c953bd /src/systems/moving.rs | |
| parent | f0153eefd580ec443b380504303620a61f24630b (diff) | |
merged Draw into View; renamed Position to Pos
Diffstat (limited to 'src/systems/moving.rs')
| -rw-r--r-- | src/systems/moving.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/systems/moving.rs b/src/systems/moving.rs index c81a766..8bce8e5 100644 --- a/src/systems/moving.rs +++ b/src/systems/moving.rs @@ -8,7 +8,7 @@ use specs::{ }; use super::super::components::{ - Position, + Pos, Controller, Blocking }; @@ -26,12 +26,12 @@ use super::super::resources::{ pub struct Move; impl <'a> System<'a> for Move { - type SystemData = (ReadStorage<'a, Controller>, WriteStorage<'a, Position>, Read<'a, Size>, ReadStorage<'a, Blocking>, Read<'a, Floor>); + type SystemData = (ReadStorage<'a, Controller>, WriteStorage<'a, Pos>, Read<'a, Size>, ReadStorage<'a, Blocking>, Read<'a, Floor>); fn run(&mut self, (controller, mut pos, size, blocking, floor): Self::SystemData) { for (controller, pos) in (&controller, &mut pos).join(){ match &controller.0 { Control::Move(direction) => { - let newpos = (*pos + direction.to_position()).clamp(Position::new(0, 0), Position::new(size.width - 1, size.height - 1)); + let newpos = (*pos + direction.to_position()).clamp(Pos::new(0, 0), Pos::new(size.width - 1, size.height - 1)); let mut blocked = false; for ent in floor.cells.get(&newpos).unwrap_or(&Vec::new()) { if blocking.get(*ent).is_some(){ |
