Browse Source

Hide train sprites initially to avoid flash

Tyler Hallada 6 years ago
parent
commit
46aba476ed
2 changed files with 2 additions and 0 deletions
  1. 1 0
      src/Train.ts
  2. 1 0
      src/transport.ts

+ 1 - 0
src/Train.ts

@@ -33,6 +33,7 @@ export default class Train {
33 33
     this.color = color;
34 34
 
35 35
     this.sprite = new PIXI.Sprite(PIXI.loader.resources.nodeImg.texture);
36
+    this.sprite.visible = false;
36 37
 
37 38
     // for debugging
38 39
     trainCount += 1;

+ 1 - 0
src/transport.ts

@@ -164,6 +164,7 @@ const drawTrains = (trains: Train[], graphics: PIXI.Graphics) => {
164 164
   for (const train of trains) {
165 165
     const trainSize = rangeMap(train.passengers, 0, TRAIN_CAPACITY, 1, 5);
166 166
     const scale = trainSize / NODE_RES;
167
+    train.sprite.visible = true;
167 168
     train.sprite.x = train.location.x;
168 169
     train.sprite.y = train.location.y;
169 170
     train.sprite.scale.x = scale;