+let explorer = {
+ position: [0,0],
+ move: function(direction) {
+ let try_pos = [0,0];
+ try_pos[0] = this.position[0];
+ try_pos[1] = this.position[1];
+ if (direction == 'left') {
+ try_pos[1] -= 1;
+ } else if (direction == 'right') {
+ try_pos[1] += 1;
+ } else if (direction == 'up') {
+ try_pos[0] -= 1;
+ } else if (direction == 'down') {
+ try_pos[0] += 1;
+ };
+ if (!(try_pos[0] < 0) &&
+ !(try_pos[1] < 0) &&
+ !(try_pos[0] >= game.map_size[0])
+ && !(try_pos[1] >= game.map_size[1])) {
+ this.position = try_pos;
+ tui.draw_map();
+ tui.refresh();
+ }
+ }
+}
+