Browse Source

fixed which row the pawns generate on and added direction control in behaviour

master
SilverEmber 4 years ago
parent
commit
e040949b37
  1. 11
      src/apr.rs
  2. 1
      src/behaviour.rs

11
src/apr.rs

@ -51,11 +51,11 @@ impl Apr {
let mut actors: Vec<actor::Actor> = Vec::new(); let mut actors: Vec<actor::Actor> = Vec::new();
for i in 0..r { for i in 0..r {
// white side // white side
actors.push(actor::Actor::new(_ctx, "/pawn.png", i, 0, 0)); actors.push(actor::Actor::new(_ctx, "/pawn.png", i, 1, 0));
} }
for i in 0..r { for i in 0..r {
// black side // black side
actors.push(actor::Actor::new(_ctx, "/pawn2.png", i, c - 1, 0)); actors.push(actor::Actor::new(_ctx, "/pawn2.png", i, c - 2, 0));
} }
Ok(Apr { Ok(Apr {
grid: make_grid(_ctx, r, c, board.board.as_slice())?, grid: make_grid(_ctx, r, c, board.board.as_slice())?,
@ -63,9 +63,10 @@ impl Apr {
should_update_grid: false, should_update_grid: false,
actors, actors,
dragging: false, dragging: false,
behaviours: vec![behaviour::Behaviour { behaviours: vec![behaviour::Behaviour { // 4-tile-corner leaper pawn behaviour
moves: vec![(0, 1)], moves: vec![(1, 1)],
}], //the pawn can go ONE forwards dirs: (1, 0, 0, 0),
}], //the pawn can go TWO diagonally and to the right and only upwards
}) })
} }

1
src/behaviour.rs

@ -1,3 +1,4 @@
pub struct Behaviour { pub struct Behaviour {
pub moves: Vec<(u8, u8)>, //this is a placeholder pub moves: Vec<(u8, u8)>, //this is a placeholder
pub dirs: (u8, u8, u8, u8), // up right down left
} }
Loading…
Cancel
Save