Browse Source

make actor method

master
SilverEmber 4 years ago
parent
commit
6f80d6fab7
  1. 7
      src/apr.rs

7
src/apr.rs

@ -49,6 +49,10 @@ impl Apr {
pub fn new(_ctx: &mut Context, r: u8, c: u8) -> GameResult<Apr> { pub fn new(_ctx: &mut Context, r: u8, c: u8) -> GameResult<Apr> {
// Load/create resources such as images here. // Load/create resources such as images here.
let board = board::make_board(r, c); let board = board::make_board(r, c);
let temp_vec: Vec<actor::Actor> = Vec<actor::Actor>::new();
for i in 0..r {
temp_vec.push(Apr::make_actor(_ctx, "/pawn.png", i, 0, 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())?,
board: board, board: board,
@ -59,7 +63,8 @@ impl Apr {
posn: actor::ActorPosn::BoardPosn { x: 0, y: 0 }, posn: actor::ActorPosn::BoardPosn { x: 0, y: 0 },
behaviour: 0, behaviour: 0,
}],*/ }],*/
actors: vec![Apr::make_actor(_ctx, "/pawn.png", 0, 0, 0)], //actors: vec![Apr::make_actor(_ctx, "/pawn.png", 0, 0, 0)],
actors: temp_vec,
behaviours: vec![behaviour::Behaviour { behaviours: vec![behaviour::Behaviour {
moves: vec![(0, 1)], moves: vec![(0, 1)],
}], //the pawn can go ONE forwards }], //the pawn can go ONE forwards

Loading…
Cancel
Save