Skip to content

Commit

Permalink
Added ground node
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBacon committed Apr 30, 2019
1 parent 21616ff commit f392cbd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/game.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ class FlappySprite extends Sprite {
}
}

class Ground extends TilingSprite {
constructor(texture) {
super(texture, Settings.width, Settings.groundHeight);
this.tileScale.set(scale * 2);
this.position.x = 0;
this.position.y = Settings.skyHeight;
}
}

class Background extends FlappySprite {
constructor(texture) {
super(texture);
Expand Down Expand Up @@ -123,14 +132,7 @@ class Game {
this.background = new Background(this.textures.background);
this.pipeContainer = new Container();

this.ground = new TilingSprite(
this.textures.ground,
Settings.width,
Settings.groundHeight,
);
this.ground.tileScale.set(scale * 2);
this.ground.position.x = 0;
this.ground.position.y = Settings.skyHeight;
this.ground = new Ground(this.textures.ground);

const bird_texture_array = [
this.textures['bird_000'],
Expand Down

0 comments on commit f392cbd

Please sign in to comment.