Projeto

Geral

Perfil

Revisão 15

Adicionado por Dinis Adriano Domingosmais de 9 anos atrás

Cell quads() are now regular rect(), prevent frame blinking while animating, correct color on flip

Ver diferenças:

Battlefield.pde
11 11
  int videoScale = 80;
12 12
  int width = 1280;
13 13
  int height = 720;
14
  
14

  
15 15
  int blacks = 0;
16 16
  int whites = 0;
17 17

  
......
29 29
  }
30 30

  
31 31
  void setup() {
32

  
33 32
    cols = width/videoScale;
34 33
    rows = height/videoScale;
35

  
36

  
37 34
    drawGrid();
38 35
  }
39 36

  
40 37
  void draw() {
41 38
    background(159, 182, 205);
42 39

  
40
    this.blacks = 0;
41
    this.whites = 0;
43 42

  
44
  this.blacks = 0;
45
  this.whites = 0;
46

  
47
  
48

  
49
       for (int i = 0; i < this.cells.length; i++) { //rows
43
    for (int i = 0; i < this.cells.length; i++) { 
44
      //rows
50 45
      for (int j = 0; j < this.cells[i].length; j++) {
51 46
        this.cells [i][j].setup ( this.cells[i][j].lifeBar, this.cells[i][j].animating );
52 47
        this.cells [i][j].draw();
53
        
48

  
54 49
        if (this.cells [i][j].isWhite ())
55
          {
50
        {
56 51
          whites++;
57
          }
52
        }
58 53
        else if (this.cells [i][j].isBlack ())
59
          {
54
        {
60 55
          blacks++;
61
          }
56
        }
62 57
      }
63 58
    }
64
    
65 59
  }
66 60

  
67 61
  /**************************************************
......
100 94
    return this.cells [cellX][cellY];
101 95
  }
102 96
}
103

  
97

  

Também disponível em: Unified diff