|
@@ -3,6 +3,7 @@ import { push } from "./push.js";
|
|
|
import { material_icon } from "./icons.js";
|
|
import { material_icon } from "./icons.js";
|
|
|
import { container } from "./container.js";
|
|
import { container } from "./container.js";
|
|
|
import { position } from "./position.js";
|
|
import { position } from "./position.js";
|
|
|
|
|
+import { move_direction } from "./moving.js";
|
|
|
|
|
|
|
|
class scene_ui {
|
|
class scene_ui {
|
|
|
#box;
|
|
#box;
|
|
@@ -25,32 +26,32 @@ class scene_ui {
|
|
|
|
|
|
|
|
this.#step_front = this.#create_push(
|
|
this.#step_front = this.#create_push(
|
|
|
"front", "arrow_drop_up",
|
|
"front", "arrow_drop_up",
|
|
|
- (player) => { player.movement.add_front(); }
|
|
|
|
|
|
|
+ (player) => { player.movement.y = move_direction.add; }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
this.#step_back = this.#create_push(
|
|
this.#step_back = this.#create_push(
|
|
|
"back", "arrow_drop_down",
|
|
"back", "arrow_drop_down",
|
|
|
- (player) => { player.movement.add_back(); }
|
|
|
|
|
|
|
+ (player) => { player.movement.y = move_direction.sub; }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
this.#step_left = this.#create_push(
|
|
this.#step_left = this.#create_push(
|
|
|
"left", "arrow_left",
|
|
"left", "arrow_left",
|
|
|
- (player) => { player.movement.add_left(); }
|
|
|
|
|
|
|
+ (player) => { player.movement.x = move_direction.sub; }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
this.#step_right = this.#create_push(
|
|
this.#step_right = this.#create_push(
|
|
|
"right", "arrow_right",
|
|
"right", "arrow_right",
|
|
|
- (player) => { player.movement.add_right(); }
|
|
|
|
|
|
|
+ (player) => { player.movement.x = move_direction.add; }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
this.#rotate_clockwise = this.#create_push(
|
|
this.#rotate_clockwise = this.#create_push(
|
|
|
"clockwise", "rotate_right",
|
|
"clockwise", "rotate_right",
|
|
|
- (player) => { player.rotation.add_right(); }
|
|
|
|
|
|
|
+ (player) => { player.rotation.z = move_direction.add; }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
this.#rotate_countclockwise = this.#create_push(
|
|
this.#rotate_countclockwise = this.#create_push(
|
|
|
"countclockwise", "rotate_left",
|
|
"countclockwise", "rotate_left",
|
|
|
- (player) => { player.rotation.add_left(); }
|
|
|
|
|
|
|
+ (player) => { player.rotation.z = move_direction.sub; }
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
this.#setup_stopers();
|
|
this.#setup_stopers();
|
|
@@ -80,19 +81,19 @@ class scene_ui {
|
|
|
document.addEventListener("keydown", (action) => {
|
|
document.addEventListener("keydown", (action) => {
|
|
|
switch (action.key) {
|
|
switch (action.key) {
|
|
|
case "w":
|
|
case "w":
|
|
|
- this.#worker.player.movement.add_front();
|
|
|
|
|
|
|
+ this.#worker.player.movement.y = move_direction.add;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case "s":
|
|
case "s":
|
|
|
- this.#worker.player.movement.add_back();
|
|
|
|
|
|
|
+ this.#worker.player.movement.y = move_direction.sub;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case "d":
|
|
case "d":
|
|
|
- this.#worker.player.movement.add_right();
|
|
|
|
|
|
|
+ this.#worker.player.movement.x = move_direction.add;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case "a":
|
|
case "a":
|
|
|
- this.#worker.player.movement.add_left();
|
|
|
|
|
|
|
+ this.#worker.player.movement.x = move_direction.sub;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
default:
|
|
@@ -104,12 +105,12 @@ class scene_ui {
|
|
|
switch (action.key) {
|
|
switch (action.key) {
|
|
|
case "w":
|
|
case "w":
|
|
|
case "s":
|
|
case "s":
|
|
|
- this.#worker.player.movement.stop_front_back();
|
|
|
|
|
|
|
+ this.#worker.player.movement.y = move_direction.stop;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
case "a":
|
|
case "a":
|
|
|
case "d":
|
|
case "d":
|
|
|
- this.#worker.player.movement.stop_left_right();
|
|
|
|
|
|
|
+ this.#worker.player.movement.x = move_direction.stop;
|
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
default:
|