Skip to content

Commit

Permalink
Add mute button to helicopter game
Browse files Browse the repository at this point in the history
  • Loading branch information
aardvarrk committed Jan 25, 2013
1 parent 71bb6b0 commit c523a3c
Show file tree
Hide file tree
Showing 3 changed files with 769 additions and 718 deletions.
Binary file modified HelicopterWorld.class
Binary file not shown.
11 changes: 8 additions & 3 deletions HelicopterWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class HelicopterWorld extends World {
private Victim victim;
private House house;
private NeedsHelp needshelp;
private MuteButton muteButton;

GreenfootSound backgroundMusic = new GreenfootSound("background_music.mp3");

public HelicopterWorld() {
Expand Down Expand Up @@ -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());
}
Expand Down
Loading

0 comments on commit c523a3c

Please sign in to comment.