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

@ -52,9 +52,10 @@ class Ball
}
else if(ctx instanceof WebGLRenderingContext)
{
const posx = (this.position.x - this.size / 2) / 2;
const posy = (this.position.y - this.size / 2) / 2;
renderCube(ctx, posx, 0, posy, 0, this.size * 5, this.size * 5, this.size * 5);
const size = this.size * 3;
const posx = (this.position.x - this.size / 2) - this.game.config.size_x / 2;
const posy = (this.position.y - this.size / 2) - this.game.config.size_y / 2;
renderCube(ctx, posx, 0, posy, 0, size, size, size);
}
else
{
@ -76,7 +77,7 @@ class Ball
this.draw(ctx);
}
from_json (data)
from_json(data)
{
this.position = this.position.from_json(data.position);
this.size = data.size;