Projeto

Geral

Perfil

Estatísticas
| Revisão:

root / processing / blacklight / Blackmatter.pde @ 18

Histórico | Ver | Anotar | Download (1,77 KB)

1
/*
2
BLACKLIGHT v1.0
3
Project made for Mestrado de Comunicação Multimédia, Ramo Multimédia Interactivo at Departamento de Comunicação e Arte at Universidade de Aveiro.
4

    
5
Author: Nuno Simaria - nsimaria@ua.pt - #23652
6
Other workgroup members: Ana Filipa Lacerda, Daniela Rei, Renato Costa, Julien Cuenin
7
*/
8

    
9

    
10
class Blackmatter
11
  {
12
  int x = 0;
13
  int y = 0;  
14
  int diameter = 50;
15
  boolean dead = false;
16
  float vx = 0;
17
  float vy = 0;
18
  
19
  void setup ()
20
    {
21
    
22
    }
23
   
24
  void draw ()
25
    {
26
    if (this.dead)
27
      return;
28
      
29
    fill (10, 50);
30
    noStroke ();
31

    
32
    ellipse (this.x, this.y, this.diameter, this.diameter);
33
    
34
    
35
    if ( ( this.x + vx <= 0 ) || ( this.x + vx >= _game_.width) ) {
36
          this.vx = -vx;
37
    }
38
    if ( ( this.y + vy <= 0 ) || ( this.y + vy >= _game_.height) ) {
39
          this.vy = -vy;
40
    }
41

    
42
    this.x += vx;
43
    this.y += vy;
44
   
45

    
46
    if (this.diameter > 0)
47
      this.diameter--;
48
    
49
    
50
    }
51
    
52
  boolean check ()
53
    {
54
    if (this.diameter <= 0)
55
      return true;
56
      
57
    return false;
58
    
59
    /*
60
    if (this.dead)
61
      return false;
62
      
63
    if ((_game_.current.lightlord.minions.length == 0) || (_game_.current.lightlord.minions [0].lighted == null))
64
      return false;  
65
      
66
    for (int i = 0; i < _game_.current.lightlord.minions [0].lighted.size (); i++)
67
      {
68
      int[] coords = (int []) _game_.current.lightlord.minions [0].lighted.get (i);
69
      
70
      Cell cell = _game_.current.battlefield.getCell (coords[0], coords[1]);
71
      println ("balancing");
72
      cell.balance++;
73
      
74
      if ((coords [0] < this.x + 40) && (coords [0] > this.x - 40) && (coords [1] < this.y + 40) && (coords [1] > this.y - 40))
75
        {
76
        this.dead = true;
77
        return true;
78
        }
79
      }
80
    
81
    return false;
82
 */  
83
  }
84
  }