Delete leftover LeftMover from tutorial
This commit is contained in:
parent
4696b53f90
commit
c2db40dd6b
5 changed files with 2 additions and 31 deletions
|
@ -1,5 +0,0 @@
|
||||||
use specs::prelude::*;
|
|
||||||
use specs_derive::Component;
|
|
||||||
|
|
||||||
#[derive(Component)]
|
|
||||||
pub struct LeftMover {}
|
|
|
@ -1,10 +1,8 @@
|
||||||
pub mod left_mover;
|
|
||||||
pub mod monster;
|
pub mod monster;
|
||||||
pub mod player;
|
pub mod player;
|
||||||
pub mod position;
|
pub mod position;
|
||||||
pub mod renderable;
|
pub mod renderable;
|
||||||
|
|
||||||
pub use left_mover::LeftMover;
|
|
||||||
pub use monster::Monster;
|
pub use monster::Monster;
|
||||||
pub use player::Player;
|
pub use player::Player;
|
||||||
pub use position::Position;
|
pub use position::Position;
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub mod vga_color;
|
||||||
use bracket_lib::prelude::*;
|
use bracket_lib::prelude::*;
|
||||||
use components::{
|
use components::{
|
||||||
monster::{color_for_kind, glyphs_for_kind, ticks_for_kind, MonsterKind},
|
monster::{color_for_kind, glyphs_for_kind, ticks_for_kind, MonsterKind},
|
||||||
LeftMover, Monster, Player, Position, Renderable,
|
Monster, Player, Position, Renderable,
|
||||||
};
|
};
|
||||||
use constants::*;
|
use constants::*;
|
||||||
use map::{Map, TileType};
|
use map::{Map, TileType};
|
||||||
|
@ -22,7 +22,7 @@ use sound::SoundSystem;
|
||||||
use sound_effects::SoundEffects;
|
use sound_effects::SoundEffects;
|
||||||
use specs::prelude::*;
|
use specs::prelude::*;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use systems::{LeftWalker, MonsterMotion};
|
use systems::MonsterMotion;
|
||||||
use vga_color as vga;
|
use vga_color as vga;
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
|
@ -147,8 +147,6 @@ impl GameState for State {
|
||||||
|
|
||||||
impl State {
|
impl State {
|
||||||
fn run_systems(&mut self) {
|
fn run_systems(&mut self) {
|
||||||
let mut lw = LeftWalker {};
|
|
||||||
lw.run_now(&self.ecs);
|
|
||||||
let mut mm = MonsterMotion {};
|
let mut mm = MonsterMotion {};
|
||||||
mm.run_now(&self.ecs);
|
mm.run_now(&self.ecs);
|
||||||
self.ecs.maintain();
|
self.ecs.maintain();
|
||||||
|
@ -183,7 +181,6 @@ fn main() -> BError {
|
||||||
|
|
||||||
gs.ecs.register::<Position>();
|
gs.ecs.register::<Position>();
|
||||||
gs.ecs.register::<Renderable>();
|
gs.ecs.register::<Renderable>();
|
||||||
gs.ecs.register::<LeftMover>();
|
|
||||||
gs.ecs.register::<Monster>();
|
gs.ecs.register::<Monster>();
|
||||||
gs.ecs.register::<Player>();
|
gs.ecs.register::<Player>();
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
use crate::components::{left_mover::LeftMover, position::Position};
|
|
||||||
use specs::prelude::*;
|
|
||||||
|
|
||||||
pub struct LeftWalker {}
|
|
||||||
|
|
||||||
impl<'a> System<'a> for LeftWalker {
|
|
||||||
type SystemData = (ReadStorage<'a, LeftMover>, WriteStorage<'a, Position>);
|
|
||||||
|
|
||||||
fn run(&mut self, (lefty, mut pos): Self::SystemData) {
|
|
||||||
for (_lefty, pos) in (&lefty, &mut pos).join() {
|
|
||||||
pos.x -= 1;
|
|
||||||
if pos.x < 0 {
|
|
||||||
pos.x = 65;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,3 @@
|
||||||
pub mod left_walker;
|
|
||||||
pub mod monster_motion;
|
pub mod monster_motion;
|
||||||
|
|
||||||
pub use left_walker::LeftWalker;
|
|
||||||
pub use monster_motion::MonsterMotion;
|
pub use monster_motion::MonsterMotion;
|
||||||
|
|
Loading…
Add table
Reference in a new issue