AAAAAAAAAAAAAAAAAAAAAAAAH

This commit is contained in:
Kbz-8
2024-02-10 19:38:56 +01:00
committed by AdrienLSH
parent acff70d414
commit 7f5bd7c6ba
8 changed files with 135 additions and 104 deletions

View File

@ -1,6 +1,6 @@
import { Game } from "./Game.js";
import { Point } from "./Point.js";
import { renderCube } from "../../3D/cube.js"
class Ball
{
@ -42,12 +42,23 @@ class Ball
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {CanvasRenderingContext2D} ctx ou pas ptdr
*/
draw(ctx)
{
ctx.rect(this.position.x - this.size / 2, this.position.y - this.size / 2, this.size, this.size);
}
if(ctx instanceof CanvasRenderingContext2D)
{
ctx.rect(this.position_x, this.position_y, this.game.config.ball_size, this.game.config.ball_size);
}
else if(ctx instanceof WebGLRenderingContext)
{
renderCube(ctx, this.position_x, 0, this.position_y, 0, this.game.config.ball_size, this.game.config.ball_size, this.game.config.ball_size);
}
else
{
alert('Unknown rendering context type (wtf)');
}
}
/**
*
@ -74,4 +85,4 @@ class Ball
}
}
export { Ball };
export { Ball }