Exemple #1
0
 @Override
 public void create(Vector2f loc, Vector2f dir) {
   Enemy alien = (Enemy) entities.get(ndx);
   if (count < maxCount) {
     alien.create();
     alien.setLoc(loc);
     alien.setDir(dir);
     activeNdxs.add(ndx);
     count++;
     ndx++;
     if (ndx == maxCount) ndx = 0;
   }
 }
Exemple #2
0
  @Override
  protected void die() throws SlickException {
    super.die();
    world.setNumberOfBosses(world.getNumberOfBosses() - 1);
    SoundManager.getInstance().playSoundEffect(deathSound);

    if (world.getState() == World.State.ENGINES_ON && !world.hasPirates()) {
      world.setState(World.State.WIN);
    }
  }
Exemple #3
0
  @Override
  public void render(Camera camera, GameContainer gameContainer) {
    Graphics graphics = gameContainer.getGraphics();
    graphics.pushTransform();
    graphics.translate(0, 40f);
    super.render(camera, gameContainer);
    graphics.popTransform();

    if (BattleToads.ALLOW_DEBUGGING) graphics.setColor(Color.magenta);
    if (BattleToads.ALLOW_DEBUGGING) graphics.draw(getCollisionHitbox(position));
  }
Exemple #4
0
  @Override
  public void update(GameContainer gameContainer, int deltaTime) throws SlickException {
    animations[animType].update(deltaTime);
    super.update(gameContainer, deltaTime);

    if (isAttacking) {
      long delta =
          world.getGame().getGameContainer().getTime() - attackStart - getAttackOffsetTime();
      if (delta >= ATTACK_MISSILE_WAIT * missileIndex
          && missileIndex < PROJECTILE_COORDINATES.length) {
        Tadpole tadpole = new Tadpole(this, getTadpoleAttack());
        getWorld().addEntity(tadpole);
        missileIndex++;
      }
    }
  }