Projeto

Geral

Perfil

Estatísticas
| Revisão:

root / processing / blacklight / Blackminion.pde @ 18

Histórico | Ver | Anotar | Download (2,38 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
class Blackminion
10
  {
11
  int x = 200;
12
  int y = 200;
13
  int diameter = 50;
14
  Input input = null;  
15
  Blacklord blacklord = null;
16
  
17
  boolean jammed = false;
18
  int timeout = 0;
19
  int charging = 0;
20
  
21
  void setup ()
22
    {
23
      
24
    }
25
    
26
  void draw ()
27
    {
28

    
29
    if (this.timeout != 0)
30
      {
31
      this.timeout--;
32
      
33
      if (this.timeout <= 0)
34
        this.jammed = false;
35
      }
36
      
37
    if (this.charging > 0)
38
      this.charging--;
39

    
40

    
41
      
42
    this.x = this.x + (this.input.horizontal ()/10);  
43
    this.y = this.y + (this.input.vertical ()/10);  
44
    
45
    if (this.x >= _game_.width - 10 - this.diameter)
46
      this.x = _game_.width - 10 - this.diameter;
47
    if (this.y >= _game_.height - 10 - this.diameter)
48
      this.y = _game_.height - 10 - this.diameter;
49
    if (this.x <= this.diameter + 10)
50
      this.x = this.diameter + 10;
51
    if (this.y <= this.diameter + 10)
52
      this.y = this.diameter + 10;
53
    
54
//    if (this.input.fire () && (this.jammed == false))
55
//      {
56
//      println ("FIRE!!!");
57
      this.fire ();
58
     // this.jammed = true;
59
     // this.timeout = 10;
60
    //  _game_.playBlackFire ();
61
//      }
62
     if (this.input.fire () && (this.charging == 0))
63
      {
64
      this.bomb ();
65
      this.charging = 30;
66
//      _game_.playBlackBomb ();
67
      }
68
    
69
    fill (1);
70
    noStroke();
71
    ellipse (this.x, this.y, this.diameter, this.diameter);
72
    }
73
    
74
  void fire ()
75
    {
76
      
77
    Blackmatter matter = new Blackmatter ();
78
    
79
    matter.x = this.x;
80
    matter.y = this.y;
81
    
82
    matter.setup ();
83
    this.blacklord.blackmatter.add (matter);
84
    
85
    }
86
    
87
  void bomb ()
88
    {
89
    for (int i = 0; i < 10; i++)
90
      {
91
      Blackmatter matter = new Blackmatter ();
92
    
93
//      matter.x = int (random (20, _game_.width - 20));
94
//      matter.y = int (random (20, _game_.height - 20));
95

    
96
      matter.x = this.x; //int (random (20, _game_.width - 20));
97
      matter.y = this.y; // int (random (20, _game_.height - 20));
98
      matter.vx = random (-5, 5);
99
      matter.vy = random (-5, 5);
100

    
101
    
102
      matter.setup ();
103
      this.blacklord.blackmatter.add (matter);
104
      }
105
    }
106
  }