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. 3
      src/behaviour.rs

11
src/apr.rs

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

3
src/behaviour.rs

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