Example #1
0
 /**
  * Herado de la clase abstracta Boton si se presiono el objecto con el cursor cambia el mundo
  * donde se encuentra
  *
  * @param m musica actual
  * @param w mundo actual
  */
 public void cambiaMundo(GreenfootSound m, World w) {
   if (Greenfoot.mouseClicked(this)) {
     Greenfoot.playSound("Click.mp3");
     w = new AyudaFondo(m);
     Greenfoot.setWorld(w);
   }
 }
 public void eat() {
   Actor crab;
   crab = getOneObjectAtOffset(0, 0, Crab.class);
   if (crab != null) {
     World world;
     world = getWorld();
     world.removeObject(crab);
     Greenfoot.playSound("eating.wav");
   }
 }
Example #3
0
  /**
   * entfernt die Mine und erzeugt 8 Splitter die in alle Richtungen fliegen soll später zusätzlich
   * sound abspielen und explosion darstellen
   */
  public void detonate() {
    int shrapnelnumber = 0;
    // erstellt 8 Splitter die nach der Detonation in alle Richtungen fliegen;
    while (shrapnelnumber != 8) {
      int shrapnelarc = shrapnelnumber * 45;

      Shrapnel name = new Shrapnel(shrapnelarc, shrapnelspeed);
      getWorld().addObject(name, this.getX(), this.getY());

      shrapnelnumber++;
    }
    this.setImage("explosion.gif");
    Greenfoot.playSound("explosion.wav");
    Greenfoot.delay(3);
    getWorld().removeObject(this);
  }
Example #4
0
  private void Special() {

    if (Greenfoot.isKeyDown("r") && specialShotInt > 120 && Spammo > 0) {

      addObjectAtOffset(new ChargeBeam(this), getX(), getY(), 80, getRotation());
      w.addObject(new CoolDown(ACT2SEC(120)), 845, 640);
      Greenfoot.playSound("Laser_Cannon.mp3");
      // !--------------!\\
      specialShotInt = 0;
      shotInterval = -78;
      Spammo--;
      SpammoUI.addPoints(-1);
    }

    specialShotInt++;
  }
Example #5
0
  public void animalEffect(String soundEffect) {

    if (Greenfoot.mouseClicked(this)) {
      Greenfoot.playSound(soundEffect);
    }
  }
Example #6
0
 /** Play the note of the key. */
 public void play() {
   Greenfoot.playSound(sound);
 }
 /** Constructor for objects of class GameOver. */
 public GameOver() {
   Greenfoot.playSound("levelEnd.wav");
   prepare();
 }