Projeto

Geral

Perfil

Estatísticas
| Revisão:

root / first_draft / Blight.pde @ 4

Histórico | Ver | Anotar | Download (884 Bytes)

1
class Blight
2
  {
3
  XMLElement[] levels;
4
  Splash splash;
5
  Level current;
6
  Detector detector;
7
   
8
  Blight (XMLElement xml)
9
    {
10
    levels = xml.getChildren();
11
    this.hello ();
12
    this.splash ();
13
    current = null;
14
    detector = new Detector ();
15
    }
16
  
17
  
18
  void hello ()
19
    {
20
    println ("Hi. I'm a Blight game.");
21
    println ("I'm made out of these levels:");
22

    
23
    for (int i = 0; i < levels.length; i++)
24
      {
25
      XMLElement level = levels [i];
26
      println (level.getChild ("name").getContent ());
27
      }      
28
    }
29
  
30

    
31
  void splash ()
32
    {
33
    splash = new Splash ();
34
    splash.draw ();
35
    }
36

    
37

    
38

    
39

    
40
  void level (int index)
41
    {
42
    splash = null;
43
    current = new Level (levels [index]);
44
    current.setup ();
45

    
46
    loop ();
47
    }
48
  
49
  void draw ()
50
    {
51
    background (0);
52
    detector.draw ();
53
    if (current != null)
54
      current.draw ();
55
    }
56
  }