From e040949b37425fe30395a50da24b5d3895b6bf71 Mon Sep 17 00:00:00 2001 From: SilverEmber Date: Fri, 31 Dec 2021 22:35:09 +1100 Subject: [PATCH] fixed which row the pawns generate on and added direction control in behaviour --- src/apr.rs | 11 ++++++----- src/behaviour.rs | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/apr.rs b/src/apr.rs index 60a76df..665ded6 100644 --- a/src/apr.rs +++ b/src/apr.rs @@ -51,11 +51,11 @@ impl Apr { let mut actors: Vec = 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 }) } diff --git a/src/behaviour.rs b/src/behaviour.rs index 571af69..5e6f484 100644 --- a/src/behaviour.rs +++ b/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 +} \ No newline at end of file