Esempio n. 1
0
 /*
  * Sets the projectile's direction and updates its location, rotation, and active status
  */
 public void update(Entity entity)
 {
     if (direction == Direction.NONE) {
         direction = entity.getDirection();
     }
     if (direction == Direction.NORTH) {
         deriveY(-1 * velocity);
     } else if (direction == Direction.SOUTH) {
         deriveY(velocity);
     } else if (direction == Direction.WEST) {
         deriveX(-1 * velocity);
     } else if (direction == Direction.EAST) {
         deriveX(velocity);
     }
     rotation = rotation + rotationSpeed;
     active = isOnScreen(entity);
 }
Esempio n. 2
0
 /*
  * Returns true if the projectile is currently on the screen; otherwise, false
  */
 public bool isOnScreen(Entity entity)
 {
     return position.X >= -texture.Width && position.X <= entity.getWindowBounds().Width && position.Y >= -texture.Height && position.Y <= entity.getWindowBounds().Height;
 }