mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-12-26 09:58:48 +01:00
same, moves -> distance_travelled
This commit is contained in:
parent
4018177e11
commit
b0651c3261
1 changed files with 4 additions and 4 deletions
|
@ -26,7 +26,7 @@ var options = {
|
||||||
};
|
};
|
||||||
var state = {
|
var state = {
|
||||||
moving : cell.BALL,
|
moving : cell.BALL,
|
||||||
moves : 0,
|
distance_travelled : 0,
|
||||||
level : 0,
|
level : 0,
|
||||||
board : ""
|
board : ""
|
||||||
};
|
};
|
||||||
|
@ -126,7 +126,7 @@ function format_level( state ) {
|
||||||
function load_level( levelset, nb ) {
|
function load_level( levelset, nb ) {
|
||||||
state.level = nb;
|
state.level = nb;
|
||||||
state.board = levelset[ state.level ];
|
state.board = levelset[ state.level ];
|
||||||
state.moves = 0;
|
state.distance_travelled = 0;
|
||||||
state.moving = cell.BALL;
|
state.moving = cell.BALL;
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -174,9 +174,9 @@ function make_a_move( state, where ) {
|
||||||
item_coord[ 1 ] += motion[ 1 ]; /* to those of target cells */
|
item_coord[ 1 ] += motion[ 1 ]; /* to those of target cells */
|
||||||
|
|
||||||
state = set_cell( state, item_coord[ 0 ], item_coord[ 1 ], state.moving ); /* move actor into target cell */
|
state = set_cell( state, item_coord[ 0 ], item_coord[ 1 ], state.moving ); /* move actor into target cell */
|
||||||
}
|
|
||||||
|
|
||||||
state.moves++; /* increment moves' counter */
|
state.distance_travelled++; /* increment distance_travelled */
|
||||||
|
}
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue