Skip to content

Commit

Permalink
added majority of sounds into game. fixed an issue when completing le…
Browse files Browse the repository at this point in the history
…vel.
  • Loading branch information
tamagokun committed May 12, 2012
1 parent 4a063fc commit 4af0551
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/Level.as
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package
public var bricks:FlxGroup;
public var ladders:FlxGroup;
public var ladder_checks:FlxGroup;
public var bgm:FlxSound;

protected var state:PlayState;

Expand Down
12 changes: 11 additions & 1 deletion app/PlayState.as
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ package

[Embed(source="../assets/bonus-box.gif")] private var ImgBonus:Class;
[Embed(source="../assets/lives.gif")] private var ImgLife:Class;
[Embed(source="../assets/audio/bacmusic.mp3")] private var SndLevel:Class;
[Embed(source="../assets/audio/complete.mp3")] private var SndWin:Class;

override public function create():void
{
Expand Down Expand Up @@ -58,6 +60,8 @@ package
add(mikey);

update_lives(mikey.lives);

level.bgm = FlxG.loadSound(SndLevel,1,true,true,true);
}

public function reset():void
Expand All @@ -67,6 +71,7 @@ package
dk.revive();
mikey.reset(31,228);
update_lives(mikey.lives);
active = true;
}

public function create_barrel(X:uint,Y:uint):void
Expand Down Expand Up @@ -97,7 +102,8 @@ package
}

override public function update():void
{
{
if(!active) return;
super.update();

FlxG.overlap(barrels, mikey, touch_barrel);
Expand All @@ -112,8 +118,12 @@ package
if(level.completed())
{
//stop game.
active = false;
barrels.clear();
dk.stop();
level.bgm.stop();
//you win!
FlxG.play(SndWin,1,false,true);
//go to next!
}

Expand Down
14 changes: 12 additions & 2 deletions app/elements/Mikey.as
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ package elements
public var climbing:Boolean = false;
public var default_collisions:int = 0;
private var _climb_speed:uint = 20;
private var _walk_sfx:FlxSound;
private var _jump_sfx:FlxSound;

private var _parent:PlayState;

[Embed(source="../../assets/mikey.gif")] private var ImgMikey:Class;
[Embed(source="../../assets/audio/jump.mp3")] private var SndJump:Class;
[Embed(source="../../assets/audio/walking.mp3")] private var SndWalk:Class;

public function Mikey(parent:PlayState):void
{
Expand All @@ -33,6 +37,9 @@ package elements
addAnimation("ladder-top-down",[7,6,5],6+FlxG.random()*2,false);
addAnimation("hammer",[9,10],6+FlxG.random()*4,false);

_walk_sfx = FlxG.loadSound(SndWalk,1,true);
_jump_sfx = FlxG.loadSound(SndJump,1,false);

var run_speed:uint = 45;
drag.x = run_speed * 8;
acceleration.y = 420;
Expand Down Expand Up @@ -68,7 +75,8 @@ package elements
{
acceleration.x = FlxG.keys.LEFT? -maxVelocity.x*4 : maxVelocity.x*4;
facing = FlxG.keys.LEFT? LEFT : RIGHT;
}
if(!jumping) _walk_sfx.play();
}else _walk_sfx.stop();
if(!climbing)
{
if(velocity.y != 0) play("jumping");
Expand All @@ -81,7 +89,9 @@ package elements
if(FlxG.keys.justPressed("SPACE") && isTouching(FlxObject.FLOOR))
{
velocity.y = -maxVelocity.y;
jumping = true;
jumping = true;
_walk_sfx.stop();
_jump_sfx.play(true);
}

if(FlxG.keys.UP && climbing) velocity.y = -_climb_speed;
Expand Down
2 changes: 1 addition & 1 deletion app/levels/Level1.as
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ package levels

override public function completed():Boolean
{
return (state.mikey.x <= 144 && state.mikey.x >= 130 && state.mikey.y <= 48);
return (state.mikey.x <= 144 && state.mikey.x >= 130 && state.mikey.y <= 42);
}

public function create_row(X:uint,Y:uint,count:uint):void
Expand Down
Binary file added assets/audio/bacmusic.mp3
Binary file not shown.
Binary file removed assets/audio/bacmusic.wav
Binary file not shown.
Binary file added assets/audio/complete.mp3
Binary file not shown.
Binary file removed assets/audio/complete.wav
Binary file not shown.
Binary file added assets/audio/intro.mp3
Binary file not shown.
Binary file removed assets/audio/intro.wav
Binary file not shown.
Binary file added assets/audio/jump.mp3
Binary file not shown.
Binary file removed assets/audio/jump.wav
Binary file not shown.
Binary file added assets/audio/turnon.mp3
Binary file not shown.
Binary file removed assets/audio/turnon.wav
Binary file not shown.
Binary file added assets/audio/walking.mp3
Binary file not shown.
Binary file removed assets/audio/walking.wav
Binary file not shown.

0 comments on commit 4af0551

Please sign in to comment.