Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:Chadius/ClimbARope

  • Loading branch information...
commit bd20e59510f2cdb5438f4de1aae68dcd924e2e5e 2 parents 41fc596 + d6f7e2d
@JayArrrgh JayArrrgh authored
View
BIN  assets/audio/Victory_1.mp3
Binary file not shown
View
33 src/Bird.as
@@ -23,6 +23,7 @@ package
public static const FLY_SPEED:Number = 6.0;
public var crashed:Boolean = false;
public var flyToTheRight:Boolean;
+ public var hasCawed:Boolean;
public function Bird(x:int, y:int)
{
@@ -31,20 +32,7 @@ package
this.loadGraphic(bird_img, true, true, 64, 64);
this.addAnimation("Fly", [0, 1], 6, true);
this.addAnimation("Crash", [2, 3], 10, false);
-
- switch (Math.floor(FlxG.random() * 3)) {
- case 0:
- FlxG.play(caw1);
- break;
- case 1:
- FlxG.play(caw2);
- break;
- case 2:
- FlxG.play(caw3);
- break;
- default:
- break;
- }
+ hasCawed = false;
//Determine facing
if (x < 270)
@@ -78,6 +66,23 @@ package
if (this.finished)
this.kill();
}
+
+ if (!hasCawed) {
+ hasCawed = true;
+ switch (Math.floor(FlxG.random() * 3)) {
+ case 0:
+ FlxG.play(caw1);
+ break;
+ case 1:
+ FlxG.play(caw2);
+ break;
+ case 2:
+ FlxG.play(caw3);
+ break;
+ default:
+ break;
+ }
+ }
super.update();
}
View
9 src/Level.as
@@ -19,6 +19,7 @@ package
public var events:EventList; //refers to all timed and positionally-cued events: enemy and projectile spawns, etc.
public var EnemyProjectiles:FlxGroup; //refers to all player and enemy projectiles
public var levelComplete:Boolean; //true if and only if player reaches the endpoint
+ public var victorySoundHasPlayed:Boolean;//true once the victory sound has played
public var endpoint:int; //the y-value the player needs to reach in order to complete the level
public var testTextField:FlxText;
@@ -33,6 +34,8 @@ package
public var resetTimerElapsed:Number; //the total time spent waiting for a reset
[Embed (source = "../assets/backgroundDay.png")] private var background_day_img:Class;
+ [Embed (source = "../assets/audio/Victory_1.mp3")] private var victorySound:Class;
+
public var background:FlxSprite; //Background image.
public var isVictoryLevel:Boolean;
@@ -44,6 +47,7 @@ package
events = theEvents;
testTextField = new FlxText(0, 0, 100, i.toString());
levelComplete = false;
+ victorySoundHasPlayed = false;
endpoint = 10;
rope = new Rope(270, 0);
player = thePlayer;
@@ -100,6 +104,11 @@ package
//Reset the level after waiting long enough.
if (resetTimerCountdown == true || isVictoryLevel == true)
{
+
+ if (!victorySoundHasPlayed) {
+ FlxG.play(victorySound);
+ victorySoundHasPlayed = true;
+ }
resetTimerElapsed += FlxG.elapsed;
if (resetTimerElapsed > resetTimerWait)
FlxG.switchState(new MenuState);
Please sign in to comment.
Something went wrong with that request. Please try again.