home *** CD-ROM | disk | FTP | other *** search
- import java.util.Enumeration;
- import java.util.Vector;
-
- class GameObjectMover extends Thread {
- int rate;
- MissileCommando parent;
-
- GameObjectMover(int var1, MissileCommando var2) {
- this.rate = var1;
- this.parent = var2;
- }
-
- public void run() {
- while(true) {
- this.parent.repaint();
-
- try {
- Thread.sleep((long)this.rate);
- } catch (Exception var1) {
- return;
- }
-
- this.checkCollisions();
- this.removeZombies();
- }
- }
-
- void checkCollisions() {
- Enumeration var1 = this.parent.shots.elements();
- Enumeration var2 = this.parent.bases.elements();
-
- while(true) {
- Shot var3 = var1.hasMoreElements() ? (Shot)var1.nextElement() : null;
- Base var4 = var2.hasMoreElements() ? (Base)var2.nextElement() : null;
- if (var3 == null && var4 == null) {
- return;
- }
-
- Enumeration var5 = this.parent.missiles.elements();
-
- while(var5.hasMoreElements()) {
- Missile var6 = (Missile)var5.nextElement();
- if (var3 != null && var6.collision(var3.x, var3.y, ((Explosion)var3).currentSize())) {
- this.parent.destroyMissile(var6);
- }
-
- if (var4 != null && ((GameObject)var4).alive() && var6.collision(var4.x, var4.y, var4.w, var4.h)) {
- this.parent.destroyBase(var4, var6);
- }
- }
-
- Enumeration var10 = this.parent.mrvs.elements();
-
- while(var10.hasMoreElements()) {
- MRV var7 = (MRV)var10.nextElement();
- if (var3 != null && var7.collision(var3.x, var3.y, ((Explosion)var3).currentSize())) {
- this.parent.destroyMRV(var7);
- }
-
- if (var4 != null && ((GameObject)var4).alive() && var7.collision(var4.x, var4.y, var4.w, var4.h)) {
- this.parent.destroyBase(var4, var7);
- }
- }
-
- Enumeration var11 = this.parent.bombs.elements();
-
- while(var11.hasMoreElements()) {
- Bomb var8 = (Bomb)var11.nextElement();
- if (var3 != null && var8.collision(var3.x, var3.y, ((Explosion)var3).currentSize())) {
- this.parent.destroyBomb(var8);
- } else if (var4 != null && ((GameObject)var4).alive() && var8.collision(var4.x, var4.y, var4.w, var4.h)) {
- this.parent.destroyBomb(var8);
- } else if (var8.y > 268) {
- this.parent.destroyBomb(var8);
- }
- }
-
- Enumeration var12 = this.parent.bombDebris.elements();
-
- while(var12.hasMoreElements()) {
- BombDebris var9 = (BombDebris)var12.nextElement();
- if (var4 != null && ((GameObject)var4).alive() && var9.collision(var4.x + var4.w / 2, var4.y + var4.h / 2, var4.w)) {
- this.parent.destroyBase(var4, var9);
- }
- }
- }
- }
-
- void removeZombies(Vector var1) {
- Enumeration var2 = var1.elements();
-
- while(var2.hasMoreElements()) {
- GameObject var3 = (GameObject)var2.nextElement();
- if (!var3.alive()) {
- if (var3 instanceof Missile) {
- Missile var4 = (Missile)var3;
- if (var4.splitme) {
- for(int var5 = 0; var5 < 3; ++var5) {
- this.parent.createMissile((int)var4.x, (int)var4.y, var4.speed);
- }
- }
- }
-
- var1.removeElement(var3);
- }
- }
-
- }
-
- void removeZombies() {
- this.removeZombies(this.parent.missiles);
- this.removeZombies(this.parent.mrvs);
- this.removeZombies(this.parent.bombs);
- this.removeZombies(this.parent.shots);
- this.removeZombies(this.parent.explosions);
- this.removeZombies(this.parent.bombDebris);
- }
- }
-