Exemplo n.º 1
0
  public void act() // sean
      {

    if (!played) {
      burningSteppes.playLoop();
      played = !played;
    }
    // makeSmokeFireball();
    counterDelay++;
    if (Greenfoot.isKeyDown("h") && delay > 10) {
      clickSound.play();
      Menu menu = new Menu(getThisWorld());
      Greenfoot.setWorld(menu);
      delay = 0;
    }
    if (getObjects(Ninja.class).size() != 0 && counterDelay >= 10) {
      healthCounter.setValue(ninja.getNINJAHP());
      shurikenCounter.setValue(ninja.getSHURIKENNUMBER());
      powerCounter.setValue(ninja.getPOWERBAR());
      checkDoor();
      counterDelay -= 10;
      /**/
      // TEMPORAY FUNCTIONS FOR HAYDEN TO CHANGE LEVELS TO MAKE THEM /**/

      /**/
      // TEMPORAY FUNCTIONS FOR HAYDEN TO CHANGE LEVELS TO MAKE THEM /**/
    }
    delay++;
    fireballDelay++;
  }
Exemplo n.º 2
0
 /*
 public void makeSmokeFireball()
 {
     if (delay > 100)
     {
         int randomNumber = Greenfoot.getRandomNumber(1000);
         if (randomNumber < 50)
         {
             SmokeFireball smokeFireball = new SmokeFireball();
             addObject(smokeFireball, 500, 475);
             delay = 0;
         }
         if (randomNumber >= 50 && randomNumber < 100)
         {
             SmokeFireball smokeFireball = new SmokeFireball();
             addObject(smokeFireball, 95, 661);
             delay = 0;
         }
         if (randomNumber >= 100 && randomNumber < 150)
         {
             SmokeFireball smokeFireball = new SmokeFireball();
             addObject(smokeFireball, 160, 493);
             delay = 0;
         }
         if (randomNumber >= 150 && randomNumber < 200)
         {
             SmokeFireball smokeFireball = new SmokeFireball();
             addObject(smokeFireball, 637, 423);
             delay = 0;
         }
         if (randomNumber >= 200 && randomNumber < 250)
         {
             SmokeFireball smokeFireball = new SmokeFireball();
             addObject(smokeFireball, 422, 285);
             delay = 0;
         }
     }
 }
 */
 public void checkDoor() // sean
     {
   if (ninja.checkInfernoDoor() == true) {
     burningSteppes.stop();
     Greenfoot.setWorld(new Inferno2(ninja));
   }
 }
Exemplo n.º 3
0
 public void salir() {
   if (Greenfoot.mousePressed(this))
   /** Cuando se hace click en la imagen aparece una imagen con los Creditose */
   {
     Greenfoot.setWorld(new Creditos());
   }
 }
Exemplo n.º 4
0
 @Override
 public void act() {
   if (Greenfoot.isKeyDown("enter")) {
     Greenfoot.setWorld(new SkyscraperWorld());
     return;
   }
 }
Exemplo n.º 5
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);
   }
 }
Exemplo n.º 6
0
  public void act() {

    // if (Greenfoot.isKeyDown("left"))
    if (Greenfoot.mouseClicked(null)) {

      Greenfoot.setWorld(new Q3());
    }
  }
Exemplo n.º 7
0
 /**
  * Method which allows for the Reset button on the Death Screen to be clicked. When the button is
  * clicked the game will restart with a new Flappy Bird.
  */
 public void act() {
   FlappyWorld startWorld =
       new FlappyWorld(); // This creates a new FlappyWorld object with a new FlappyBird and all
   // parts involved in FlappyWorld class.
   if (Greenfoot.mouseClicked(this)
       == true) { // This makes it so when the OK reset button is pressed the world will restart,
     // and be set to a new FlappyWorld.
     Greenfoot.setWorld(startWorld);
   }
 }
Exemplo n.º 8
0
 /**
  * Act - do whatever the Notice wants to do. This method is called whenever the 'Act' or 'Run'
  * button gets pressed in the environment.
  */
 public void act() {
   Scenario e = (Scenario) getWorld();
   if (vel < 0) move(vel);
   vel--;
   if (getX() + getImage().getWidth() / 2 < 0) {
     if (fin == true) {
       if (e.getActualSound().isPlaying()) e.getActualSound().stop();
       Greenfoot.setWorld(new Menu());
     } else getWorld().removeObject(this);
   }
 }
Exemplo n.º 9
0
  public void act() {
    if (isHiglighted()) {
      setImage(rGFI);
    } else {
      setImage(gfi);
    }

    if (isClicked() && world != null) {
      Greenfoot.setWorld(world);
    }
  }
  public void act() {
    // System.out.print("Score:" + score);
    setImage(new GreenfootImage("Health: 3, Score: " + score, 20, Color.GREEN, Color.BLACK));

    // creating next level

    if (score == level2) {
      setImage(new GreenfootImage("Level 2 Complete", 18, Color.YELLOW, Color.BLACK));
      Greenfoot.delay(200); // timer tampilan
      // getWorld().removeObject(this);
      Greenfoot.setWorld(new Level3()); // masuk ke Level3();
    }
  }
Exemplo n.º 11
0
 public void gameover() { // Hayden
   ninja.setHP(ninja.getArmor());
   burningSteppes.stop();
   Greenfoot.setWorld(new Inferno1(ninja));
 }
Exemplo n.º 12
0
 public void nextScene(StarDuck starduck) {
   Greenfoot.setWorld(new Scene9(starduck));
 }