BonusDesc.java
001 package rtype;
002 
003 import org.lwjgl.input.Keyboard;
004 import org.lwjgl.opengl.Display;
005 import org.lwjgl.util.vector.Vector2f;
006 
007 import rtype.entity.BonusBooster;
008 import rtype.entity.BonusCrystalOrb;
009 import rtype.entity.BonusLightningOrb;
010 import rtype.entity.BonusMagneticOrb;
011 import rtype.entity.BonusRapidShootOrb;
012 import rtype.entity.CrystalOrb;
013 import rtype.entity.LightningOrb;
014 import rtype.entity.MagneticOrb;
015 import rtype.entity.PlayerShip;
016 import rtype.entity.RapidFireOrb;
017 import rtype.entity.Text;
018 
019 public class BonusDesc {
020 
021   private Layer layer = new Layer()
022   private Layer nullLayer = new Layer();
023   private Prototyp prototyp;
024   boolean bonusOn = true;
025   
026   int ORIGIN_X = -55;
027   int ORIGIN_Y = 170;
028   int interspaceY = 60;
029   int interspaceX = 100;
030   
031   public BonusDesc(Prototyp prototyp)
032   {
033     this.prototyp = prototyp;
034     
035     KeyListener space = new KeyListener()
036     {
037         public void onKeyUp()
038         {
039           bonusOn = false;
040           Prototyp.timer.resume();
041         }
042     };
043     EventManager.instance().addListener(Keyboard.KEY_SPACE,space);    
044     
045     int pointY = ORIGIN_Y;
046     int pointX = ORIGIN_X;
047     
048     Vector2f immobile = new Vector2f(0,0);
049     
050     
051     
052     PlayerShip lightning = new PlayerShip();
053     LightningOrb lorb = new LightningOrb(lightning);
054     
055     PlayerShip rapid = new PlayerShip();
056     RapidFireOrb rforb = new RapidFireOrb(rapid);
057     
058     PlayerShip magnetic = new PlayerShip();
059     MagneticOrb morb = new MagneticOrb(magnetic);
060     
061     PlayerShip crystal = new PlayerShip();
062     CrystalOrb corb = new CrystalOrb(crystal);
063     
064     PlayerShip booster = new PlayerShip();
065     
066     BonusLightningOrb lBonus = new BonusLightningOrb();
067         BonusRapidShootOrb rBonus = new BonusRapidShootOrb();
068         BonusMagneticOrb mBonus = new BonusMagneticOrb();
069         BonusCrystalOrb cBonus = new BonusCrystalOrb();
070         BonusBooster bBonus = new BonusBooster();
071         
072         Text commandLabel = new Text("One more thing...");
073         Text lightningLabel = new Text("Lightning Orb :");
074         Text rapidLabel =     new Text("RapidFire Orb :");
075         Text magneticLabel =  new Text("Magnetic  Orb :");
076         Text crystalLabel =   new Text("Crystal   Orb :");
077         Text boosterLabel =   new Text("Booster   Orb :");
078         
079         
080     commandLabel.spawn(new Vector2f(pointX,pointY), immobile, layer);
081         
082     pointX = ORIGIN_X - interspaceX*2;
083         pointY = ORIGIN_Y;
084         
085         pointY-=interspaceY;
086         lightningLabel.spawn(new Vector2f(pointX,pointY), immobile, layer);
087         
088         pointY-=interspaceY;
089         rapidLabel.spawn(new Vector2f(pointX,pointY), immobile, layer);
090         
091         pointY-=interspaceY;
092         magneticLabel.spawn(new Vector2f(pointX,pointY), immobile, layer);
093         
094         pointY-=interspaceY;
095         crystalLabel.spawn(new Vector2f(pointX,pointY), immobile, layer);
096         
097         pointY-=interspaceY;
098         boosterLabel.spawn(new Vector2f(pointX,pointY), immobile, layer);
099         
100     pointX = ORIGIN_X + 50 ;
101         pointY = ORIGIN_Y;
102     
103         pointY-=interspaceY;
104         lBonus.spawn(new Vector2f(pointX,pointY), immobile, layer);
105         
106         pointY-=interspaceY;
107         rBonus.spawn(new Vector2f(pointX,pointY), immobile, layer);
108         
109         pointY-=interspaceY;
110         mBonus.spawn(new Vector2f(pointX,pointY), immobile, layer);
111         
112         pointY-=interspaceY;
113         cBonus.spawn(new Vector2f(pointX,pointY), immobile, layer);
114         
115         pointY-=interspaceY;
116         bBonus.spawn(new Vector2f(pointX,pointY), immobile, layer);
117         
118         pointX = ORIGIN_X + interspaceX+ 50;
119         pointY = ORIGIN_Y;
120         
121         pointY-=interspaceY;
122         lightning.spawn(new Vector2f(pointX,pointY), immobile, nullLayer);
123         lorb     .spawn(new Vector2f(pointX-400,pointY), immobile, layer);
124         
125         pointY-=interspaceY;
126         rapid    .spawn(new Vector2f(pointX,pointY), immobile, nullLayer);
127         rforb    .spawn(new Vector2f(pointX-400,pointY), immobile, layer);
128         
129         pointY-=interspaceY;
130         magnetic .spawn(new Vector2f(pointX,pointY), immobile, nullLayer);
131         morb     .spawn(new Vector2f(pointX-400,pointY), immobile, layer);
132         
133         pointY-=interspaceY;
134         crystal  .spawn(new Vector2f(pointX,pointY), immobile, nullLayer);
135         corb     .spawn(new Vector2f(pointX-400,pointY), immobile, layer);
136     
137         pointY-=interspaceY;
138         booster  .spawn(new Vector2f(pointX+60,pointY), immobile, nullLayer);
139         booster.addBooster(layer);
140     booster.addBooster(layer);
141 
142     
143     
144 
145   }
146   
147   public void play()
148   {
149     //prototyp.timer.pause();
150       
151     //NastyHack, I'm sorry
152     
153     // No more madness...
154     
155       while (bonusOn)
156       {
157         Prototyp.heartBeat();
158             layer.update();
159         
160         prototyp.render();
161         layer.render();
162         
163         Display.update();
164         
165         if (prototyp.exitRequested())
166         {
167           bonusOn = false;
168           prototyp.gameOff = true;
169         }
170         EventManager.instance().checkEvents();  
171       }
172       EventManager.instance().clear();
173       
174   }
175 }