Permalink
Browse files

Add mute button to helicopter game

  • Loading branch information...
1 parent 71bb6b0 commit c523a3cfd57c6d1be52622ce964ccfd63fef6082 @aardvarrk aardvarrk committed Jan 25, 2013
Showing with 769 additions and 718 deletions.
  1. BIN HelicopterWorld.class
  2. +8 −3 HelicopterWorld.java
  3. +761 −715 project.greenfoot
View
Binary file not shown.
View
@@ -23,6 +23,8 @@
private Victim victim;
private House house;
private NeedsHelp needshelp;
+ private MuteButton muteButton;
+
GreenfootSound backgroundMusic = new GreenfootSound("background_music.mp3");
public HelicopterWorld() {
@@ -120,15 +122,18 @@ public HelicopterWorld() {
health6 = new Health2();
addObject(health6, 68, 77);
- setPaintOrder(Counter.class, HP.class, Health2.class, Health.class, Helicopter.class, MenuBar.class, Wall.class, Water.class, Victim.class, MenuBar.class, House.class, SpeedPowerUp.class, RadiusPowerUp.class, NeedsHelp.class);
+ setPaintOrder(MuteButton.class, Counter.class, HP.class, Health2.class, Health.class, Helicopter.class, MenuBar.class, Wall.class, Water.class, Victim.class, MenuBar.class, House.class, SpeedPowerUp.class, RadiusPowerUp.class, NeedsHelp.class);
+
+ addObject(muteButton = new MuteButton(), 75, 75);
+ muteButton.registerSound(backgroundMusic);
}
@Override
public void act() {
//Check actors
for (Actor actor : (List<Actor>)getObjects(null)) {
- if (actor == helicopter) continue;
- if (actor == scoreCounter) continue;
+ if (actor == helicopter || actor == scoreCounter || actor == muteButton) continue;
+
actor.setLocation(actor.getX() + 40 - helicopter.getX(), actor.getY());
}
Oops, something went wrong.

0 comments on commit c523a3c

Please sign in to comment.