Class SpriteMissile

java.lang.Object
  |
  +--Sprite
        |
        +--SpriteMissile

class SpriteMissile
extends Sprite

A missile is the kind of "bullet" that the Ufo shoots. It's guided, that is, it heads towards the ship.


Field Summary
(package private) static int MISSILE_POINTS
          Points for shooting a Missile.
 
Fields inherited from class Sprite
acceleration, active, age, ageDone, angle, angularAcceleration, bounce, edgecolor, fillcolor, fillflag, game, mass, maxspeed, ownerApp, position, positiontransform, radius, shape, shapetransform, soundplaying, velocity
 
Constructor Summary
SpriteMissile(RealPixelConverter rtopc)
           
 
Method Summary
 void headTowardsSprite(Sprite target, boolean moving)
          At present this method is only used by the missile, but we might consider letting the asteroids use it too! The boolean flag tells whether to just menacingly aim yoursef (false) or to actually move this way (true).
 void loopsound(boolean onoff)
          Toggles the missileSound.
 void reset(RealPixelConverter rtopc)
          The abstract reset method is called by the child sprite constructors, and may also be called when resetting a sprite's state.
 void update(RealPixelConverter rtopc)
          Move the guided missile and check for collision with ship or bullet.
 
Methods inherited from class Sprite
advance, draw, explode, fixRadius, isColliding, isTouching, mass, radius, randomizeFillcolor, render, setFakeRadius, stop, wrapandbounce
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MISSILE_POINTS

static final int MISSILE_POINTS
Points for shooting a Missile. 500.
Constructor Detail

SpriteMissile

public SpriteMissile(RealPixelConverter rtopc)
Method Detail

loopsound

public void loopsound(boolean onoff)
Toggles the missileSound.
Overrides:
loopsound in class Sprite

reset

public void reset(RealPixelConverter rtopc)
Description copied from class: Sprite
The abstract reset method is called by the child sprite constructors, and may also be called when resetting a sprite's state. It needs the RealPixelConverter because if we change a sprite's postion we like to call render right away so as to have correct information in shapetransform for use by the isTouching mehtod.
Overrides:
reset in class Sprite

headTowardsSprite

public void headTowardsSprite(Sprite target,
                              boolean moving)
At present this method is only used by the missile, but we might consider letting the asteroids use it too! The boolean flag tells whether to just menacingly aim yoursef (false) or to actually move this way (true).

update

public void update(RealPixelConverter rtopc)
Move the guided missile and check for collision with ship or bullet. Stop it when its too old. Use isTouching so its hard to hit missile.
Overrides:
update in class Sprite