push pop
This commit is contained in:
parent
a464da424a
commit
e0e7f5bb60
4 changed files with 6 additions and 2 deletions
|
|
@ -51,7 +51,9 @@ abstract class Entity {
|
||||||
public abstract update(): void;
|
public abstract update(): void;
|
||||||
|
|
||||||
public draw(): void {
|
public draw(): void {
|
||||||
|
push();
|
||||||
fill(this.fill);
|
fill(this.fill);
|
||||||
rect(this.position.x, this.position.y, this.width, this.height);
|
rect(this.position.x, this.position.y, this.width, this.height);
|
||||||
|
pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,6 @@ class Obstacle extends Entity implements Collidable{
|
||||||
}
|
}
|
||||||
|
|
||||||
public draw(): void {
|
public draw(): void {
|
||||||
noFill();
|
|
||||||
this.pipeTop.draw();
|
this.pipeTop.draw();
|
||||||
this.pipeBottom.draw();
|
this.pipeBottom.draw();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ class Pipe extends Entity implements Collidable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public draw(): void {
|
public draw(): void {
|
||||||
|
push();
|
||||||
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
||||||
noFill();
|
noFill();
|
||||||
rect(
|
rect(
|
||||||
|
|
@ -28,6 +29,7 @@ class Pipe extends Entity implements Collidable {
|
||||||
this.width,
|
this.width,
|
||||||
this.height
|
this.height
|
||||||
);
|
);
|
||||||
|
pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
collides(o: Entity): boolean {
|
collides(o: Entity): boolean {
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,9 @@ class Raspberry extends Entity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public draw(): void {
|
public draw(): void {
|
||||||
|
push();
|
||||||
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
||||||
noFill();
|
noFill();
|
||||||
strokeWeight(50);
|
|
||||||
if (!this.showHitbox) {
|
if (!this.showHitbox) {
|
||||||
noStroke();
|
noStroke();
|
||||||
}
|
}
|
||||||
|
|
@ -69,5 +69,6 @@ class Raspberry extends Entity {
|
||||||
this.width,
|
this.width,
|
||||||
this.height
|
this.height
|
||||||
);
|
);
|
||||||
|
pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue