home *** CD-ROM | disk | FTP | other *** search
- import com.next.gt.Actor;
- import com.next.gt.Gamelication;
- import java.awt.Image;
- import java.awt.MediaTracker;
-
- public class Goobie extends Actor {
- private static double GRAVITATIONAL_PULL = (double)0.5F;
-
- Goobie(Gamelication var1, Bigoobie var2) {
- super.owner = var1;
- Image var3 = super.owner.getImage(super.owner.getCodeBase(), "images/goobie.gif");
- MediaTracker var4 = new MediaTracker(var1);
- var4.addImage(var3, 0);
-
- try {
- var4.waitForID(0);
- } catch (InterruptedException var5) {
- }
-
- super.x = (double)((int)(var2.x - (double)(super.width - var2.width) / (double)2.0F));
- super.y = (double)((int)(var2.y - (double)(super.height - var2.height) / (double)2.0F));
- super.velocity_x = var2.velocity_x * Gamelication.randBetween(0.2, 1.4);
- super.velocity_y = var2.velocity_y * Gamelication.randBetween(0.2, 1.4);
- ((Actor)this).setImage(var3);
- }
-
- public void calculateNewPosition() {
- super.calculateNewPosition();
- if (((Boinkaroids)super.owner).player != null) {
- if (super.x > ((Boinkaroids)super.owner).player.x) {
- super.velocity_x -= GRAVITATIONAL_PULL;
- } else {
- super.velocity_x += GRAVITATIONAL_PULL;
- }
-
- if (super.y > ((Boinkaroids)super.owner).player.y) {
- super.velocity_y -= GRAVITATIONAL_PULL;
- } else {
- super.velocity_y += GRAVITATIONAL_PULL;
- }
- }
- }
-
- public void explode() {
- super.owner.play(super.owner.getCodeBase(), "sounds/smack.au");
- super.owner.scoreManager.addToScore(1000);
- super.owner.actorManager.removeActor(this);
- ((Boinkaroids)super.owner).removeOneBadGuy();
- }
-
- protected void collideWithActor(Actor var1) {
- String var2 = var1.getClass().getName();
- if (var2.equals("Bullet") || var2.equals("Ship")) {
- this.explode();
- }
-
- }
- }
-