code review
This commit is contained in:
parent
ba2d9f17e1
commit
7d84f51d91
3 changed files with 9 additions and 12 deletions
|
|
@ -1,9 +1,9 @@
|
|||
class Obstacle extends Entity {
|
||||
private pipeTop: Pipe;
|
||||
private pipeBottom: Pipe;
|
||||
private distanceBetweenPipes: number;
|
||||
private padding: number = 300;
|
||||
private speed: number = 8;
|
||||
private readonly distanceBetweenPipes: number;
|
||||
private readonly padding: number = 300;
|
||||
private readonly speed: number = 8;
|
||||
|
||||
private static startX: number;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ class Pipe extends Entity {
|
|||
public update(): void {}
|
||||
|
||||
public draw(): void {
|
||||
// @ts-ignore
|
||||
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
||||
noFill();
|
||||
rect(
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
class Raspberry extends Entity {
|
||||
private lift: number = -10;
|
||||
private gravity: number = 1;
|
||||
private readonly lift: number = -10;
|
||||
private readonly gravity: number = 1;
|
||||
private _velocity: number = 0;
|
||||
private _image: any;
|
||||
private static maxVelocity: number = 5;
|
||||
private static readonly maxVelocity: number = 5;
|
||||
|
||||
constructor() {
|
||||
super(new Position(width / 6, height / 2), 180, 70, 0);
|
||||
|
|
@ -34,10 +34,8 @@ class Raspberry extends Entity {
|
|||
}
|
||||
|
||||
private applyGravity(): void {
|
||||
if (this.position.y - this.height > 0) {
|
||||
this.velocity += this.gravity;
|
||||
}
|
||||
}
|
||||
|
||||
private forceBoundaries(): void {
|
||||
if (this.position.y > height) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue