wat
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { Game } from "./Game.js";
|
||||
import { Point } from "./Point.js";
|
||||
|
||||
import { renderCube } from "../../3D/cube.js"
|
||||
|
||||
class Ball
|
||||
{
|
||||
@ -46,7 +46,19 @@ class Ball
|
||||
*/
|
||||
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.size / 2, this.position.y - this.size / 2, this.size, this.size);
|
||||
}
|
||||
else if(ctx instanceof WebGLRenderingContext)
|
||||
{
|
||||
console.log((this.position.x - this.size / 2) / 10, 0, (this.position.y - this.size / 2) / 10)
|
||||
renderCube(ctx, (this.position.x - this.size / 2) / 10, 0, (this.position.y - this.size / 2) / 10, 0, this.size * 10, this.size * 10, this.size * 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert('Unknown rendering context type');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Game } from "./Game.js";
|
||||
import { Point } from "./Point.js";
|
||||
import { Segment } from "./Segment.js";
|
||||
import { renderCube } from "../../3D/cube.js"
|
||||
|
||||
class Player
|
||||
{
|
||||
@ -61,8 +62,11 @@ class Player
|
||||
{
|
||||
if (this.is_connected === false)
|
||||
{
|
||||
ctx.moveTo(this.rail.start.x, this.rail.start.y);
|
||||
ctx.lineTo(this.rail.stop.x, this.rail.stop.y);
|
||||
if(ctx instanceof CanvasRenderingContext2D)
|
||||
{
|
||||
ctx.moveTo(this.rail.start.x, this.rail.start.y);
|
||||
ctx.lineTo(this.rail.stop.x, this.rail.stop.y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user