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 draw(): void {
|
||||
push();
|
||||
fill(this.fill);
|
||||
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 {
|
||||
noFill();
|
||||
this.pipeTop.draw();
|
||||
this.pipeBottom.draw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ class Pipe extends Entity implements Collidable {
|
|||
}
|
||||
|
||||
public draw(): void {
|
||||
push();
|
||||
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
||||
noFill();
|
||||
rect(
|
||||
|
|
@ -28,6 +29,7 @@ class Pipe extends Entity implements Collidable {
|
|||
this.width,
|
||||
this.height
|
||||
);
|
||||
pop();
|
||||
}
|
||||
|
||||
collides(o: Entity): boolean {
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ class Raspberry extends Entity {
|
|||
}
|
||||
|
||||
public draw(): void {
|
||||
push();
|
||||
image(this.image, this.position.x, this.position.y, this.width, this.height);
|
||||
noFill();
|
||||
strokeWeight(50);
|
||||
if (!this.showHitbox) {
|
||||
noStroke();
|
||||
}
|
||||
|
|
@ -69,5 +69,6 @@ class Raspberry extends Entity {
|
|||
this.width,
|
||||
this.height
|
||||
);
|
||||
pop();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue