3D working

This commit is contained in:
Kbz-8
2024-02-22 06:01:56 +01:00
parent 81355bf7b5
commit a7fff2f1a2
13 changed files with 71 additions and 50 deletions

View File

@ -1,7 +1,6 @@
import { Game } from "./Game.js";
import { Point } from "./Point.js";
import { Segment } from "./Segment.js";
import { renderCube } from "../../3D/cube.js"
class Player
{
@ -44,7 +43,7 @@ class Player
/**
* @type {Segment}
*/
this.rail = rail === undefined ? new Segment() : rail;
this.rail = rail === undefined ? new Segment(game) : rail;
/**
* @type {String}
@ -89,12 +88,12 @@ class Player
paddle_start_y = paddle_center.y - (diff_y * (paddle_length / 2 / rail_length)),
paddle_stop_x = paddle_center.x + (diff_x * (paddle_length / 2 / rail_length)),
paddle_stop_y = paddle_center.y + (diff_y * (paddle_length / 2 / rail_length));
let paddle_start = new Point(paddle_start_x, paddle_start_y),
paddle_stop = new Point (paddle_stop_x, paddle_stop_y);
let paddle = new Segment(paddle_start, paddle_stop);
let paddle = new Segment(this.game, paddle_start, paddle_stop);
paddle.draw(ctx);
}