aboutsummaryrefslogtreecommitdiffstats
path: root/src/drawables/Startscreen.ts
blob: ea8dc40647601ce35ec222caa6d7872443b8d80c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { TOPBAR_HEIGHT } from "../consts"
import Drawable from "../Drawable"
import { IMGS } from "../Images"

export default class Startscreen extends Drawable {
  sprite = IMGS.startScreen0
  si = 0
  i = 0  
  j = 0
  color = "white"
  colors = ["white", "yellow", "blue", "purple", "red"]
  ci = 0

  constructor() {
    super(0, TOPBAR_HEIGHT)
  }

  move() {
    if(this.si === 0) {
      if(this.i++ === 199) { this.sprite = IMGS.startScreen1; this.i = 0; this.si++ }
      // if(this.i++ === 19) { this.sprite = IMGS.startScreen1; this.i = 0; this.si++ }
    } else {
      // if(this.i++ === 2) {
      if(this.i++ === 9) {
        this.ci++;
        if(this.ci >= this.colors.length) {
          if(this.j++ === 9) {
          // if(this.j++ === 2) {
            this.si++;
            if(this.si > 4) this.si = 0
            //@ts-expect-error
            this.sprite = IMGS["startScreen" + this.si]
            this.j = 0
          }
            this.ci = 0;
        }
        this.color = this.colors[this.ci]
        this.i = 0
      }
    }
    // console.log(this.sprite, this.color);

    return true;
  }
}