AAAAAAAAAAAAAAAAAAAAAAAAH

This commit is contained in:
Kbz-8
2024-02-10 19:38:56 +01:00
parent f9e9538159
commit 54c4ae77f2
8 changed files with 134 additions and 93 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
{
@ -38,12 +38,23 @@ class Ball
/**
*
* @param {CanvasRenderingContext2D} ctx
* @param {CanvasRenderingContext2D} ctx ou pas ptdr
*/
draw(ctx)
{
ctx.rect(this.position_x, this.position_y, this.game.config.ball_size, this.game.config.ball_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)');
}
}
render()
{
@ -79,4 +90,4 @@ class Ball
}
}
export { Ball }
export { Ball }