RebusGameVisualEffects.js 751 B

12345678910111213141516171819202122
  1. class RebusGameVisualEffects extends Object2D
  2. {
  3. suffix = "";
  4. bgOpacity = 0;
  5. textOpacity = 0;
  6. _draw(delta, db)
  7. {
  8. if (this.parent.gameFinished)
  9. {
  10. db.noStroke();
  11. db.fill(0, min(this.bgOpacity += 75 * delta, 200));
  12. db.rectMode(CENTER);
  13. db.rect(db.width / 2, db.height / 2, 1800, 600, 40, 40);
  14. db.textAlign(CENTER, CENTER);
  15. db.fill(255, min(this.textOpacity += 80 * delta, 255));
  16. db.textSize(40);
  17. this.parent.points > 1 ? this.suffix = "S" : this.suffix = "";
  18. db.text(`PARABÉNS, NÍVEL CONCLUÍDO\nVOCÊ GANHOU ${this.parent.points} PONTO${this.suffix}!`, db.width / 2, db.height / 2 - 100);
  19. }
  20. }
  21. }