home *** CD-ROM | disk | FTP | other *** search
- head 1.3;
- access;
- symbols;
- locks; strict;
- comment @# @;
-
-
- 1.3
- date 98.04.15.16.30.07; author mds1274; state Exp;
- branches;
- next 1.2;
-
- 1.2
- date 98.04.15.16.03.49; author jgh8962; state Exp;
- branches;
- next 1.1;
-
- 1.1
- date 98.04.10.17.53.49; author jgh8962; state Exp;
- branches;
- next ;
-
-
- desc
- @@
-
-
- 1.3
- log
- @*** empty log message ***
- @
- text
- @/**
- *
- * Bullet.java
- * @@author Mark G. Tacchi (mtacchi@@next.com)
- * @@version 0.8
- * Mar 12/1996
- *
- * A Bullet is created by the Ship object when it is sent a fire message.
- * Bullets live for a specified time to live (ttl).
- *
- * This Actor collides with all but Ships and Explosions.
- *
- */
-
- import java.awt.*;
- import com.next.gt.*;
-
- public class Bullet extends Actor {
-
- //
- // variable used to compare against for auto death
- //
- long startTime;
-
- //
- // time to live
- //
- long ttl= 1750;
-
- //
- // the ship object
- //
- Ship explodee;
-
-
- Bullet(Gamelication theOwner, Ship theExplodee) {
- super();
-
- double explodeeVelocity= theExplodee.getSpeed();
- double explodeeTheta= theExplodee.getTheta();
- Image theImage;
-
- owner= theOwner;
- explodee= theExplodee;
-
- x= (explodee.x + (explodee.width/2.0));
- y= (explodee.y + (explodee.height/2.0));
-
- theImage= owner.getImage(owner.getCodeBase(), "images/bullet.gif");
- setImage (theImage, 4, 16);
-
- velocity_x= Math.cos(explodeeTheta)*(explodeeVelocity + 150.);
- velocity_y= Math.sin(explodeeTheta+Math.PI)*(explodeeVelocity + 150.);
-
- x+= (velocity_x * .1);
- y+= (velocity_y * .1);
-
- startTime= owner.currentTickTimeMillis;
- } /*Bullet()*/
-
-
- /**
- * Override tick to implement a timed death.
- */
- public void tick(){
- super.tick();
-
- if (owner.currentTickTimeMillis - startTime > ttl) {
- if (explodee.numBullets>0)
- explodee.numBullets--;
- owner.actorManager.removeActor (this);
- } /*endif*/
- } /*tick*/
-
-
-
- /**
- * Handle collision with an actor.
- */
- protected void collideWithActor (Actor theActor){
- String theActorClassName= theActor.getClass().getName();
-
- if (theActorClassName.equals("Asteroid") ||
- theActorClassName.equals("Bigoobie")) {
- if (explodee.numBullets>0)
- explodee.numBullets--;
- owner.actorManager.removeActor(this);
- } /*endif*/
-
- } /*collideWithActor*/
-
- } /*Bullet*/
- @
-
-
- 1.2
- log
- @*** empty log message ***
- @
- text
- @a15 1
-
- d20 4
- a23 4
- //
- // variable used to compare against for auto death
- //
- long startTime;
- d25 4
- a28 4
- //
- // time to live
- //
- long ttl= 1750;
- d30 5
- a34 4
- //
- // the ship object
- //
- Ship explodee;
- d37 1
- a37 1
- super();
- d39 3
- a41 3
- double explodeeVelocity= theExplodee.getSpeed();
- double explodeeTheta= theExplodee.getTheta();
- Image theImage;
- d43 2
- a44 2
- owner= theOwner;
- explodee= theExplodee;
- d46 2
- a47 2
- x= (explodee.x + (explodee.width/2.0));
- y= (explodee.y + (explodee.height/2.0));
- d49 2
- a50 2
- theImage= owner.getImage(owner.getCodeBase(), "images/bullet.gif");
- setImage (theImage, 4, 16);
- d52 2
- a53 2
- velocity_x= Math.cos(explodeeTheta)*(explodeeVelocity + 150.);
- velocity_y= Math.sin(explodeeTheta+Math.PI)*(explodeeVelocity + 150.);
- d55 2
- a56 3
- x+= (velocity_x * .1);
- y+= (velocity_y * .1);
-
- d58 1
- a58 2
- startTime= owner.currentTickTimeMillis;
-
- a61 1
-
- d65 2
- a66 3
- public void tick()
- {
- super.tick();
- d68 5
- a72 5
- if (owner.currentTickTimeMillis - startTime > ttl) {
- if (explodee.numBullets>0)explodee.numBullets--;
- owner.actorManager.removeActor (this);
- } /*endif*/
-
- d80 2
- a81 3
- protected void collideWithActor (Actor theActor)
- {
- String theActorClassName= theActor.getClass().getName();
- d83 6
- a88 5
- if (theActorClassName.equals("Asteroid") ||
- theActorClassName.equals("Bigoobie")) {
- if (explodee.numBullets>0)explodee.numBullets--;
- owner.actorManager.removeActor(this);
- } /*endif*/
- d91 1
- @
-
-
- 1.1
- log
- @Initial revision
- @
- text
- @d29 1
- a29 1
- long ttl= 1500;
- @
-