fixing merge
This commit is contained in:
parent
f1f6cc939a
commit
04afee89d2
@ -1,6 +1,6 @@
|
||||
import { Game } from "./Game.js";
|
||||
import { Point } from "./Point.js";
|
||||
import { renderCube } from "../../3D/cube.js"
|
||||
|
||||
|
||||
class Ball
|
||||
{
|
||||
@ -42,23 +42,12 @@ class Ball
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {CanvasRenderingContext2D} ctx ou pas ptdr
|
||||
* @param {CanvasRenderingContext2D} ctx
|
||||
*/
|
||||
draw(ctx)
|
||||
{
|
||||
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 / 1000, 0, this.position_y / 1000, 0, this.game.config.ball_size, this.game.config.ball_size, this.game.config.ball_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Unknown rendering context type (wtf)');
|
||||
}
|
||||
}
|
||||
ctx.rect(this.position.x - this.size / 2, this.position.y - this.size / 2, this.size, this.size);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -66,7 +55,7 @@ class Ball
|
||||
*/
|
||||
render(ctx)
|
||||
{
|
||||
let distance = this.speed * (this.game.time.deltaTime() / 1000);
|
||||
let distance = this.speed * (this.game.time.deltaTime() / 1000)
|
||||
|
||||
this.position.x = this.position.x + distance * Math.cos(this.angle);
|
||||
this.position.y = this.position.y - distance * Math.sin(this.angle);
|
||||
@ -81,7 +70,7 @@ class Ball
|
||||
this.angle = data.angle;
|
||||
this.speed = data.speed;
|
||||
|
||||
return this;
|
||||
return this
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user