Skip to content

Commit

Permalink
Wrap pitch in FLX_PITCH flag (#341)
Browse files Browse the repository at this point in the history
* wrap pitch

* wrap pitch
  • Loading branch information
Geokureli authored Apr 5, 2024
1 parent 7b62dc5 commit f947b8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Arcade/FlxInvaders/source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ class PlayState extends FlxState
function stuffHitStuff(Object1:FlxObject, Object2:FlxObject):Void
{
var wallSound:FlxSound = FlxG.sound.play("assets/wall_break.wav");
#if FLX_PITCH
wallSound.pitch = FlxG.random.float(0.9, 1.1);
#end
Object1.kill();
Object2.kill();
}
Expand Down
2 changes: 2 additions & 0 deletions Arcade/FlxInvaders/source/PlayerShip.hx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class PlayerShip extends FlxSprite
{
// Play a sound effect when the player shoots with slight random pitch
var shootSound:FlxSound = FlxG.sound.play("assets/player_shoot.wav", 0.5);
#if FLX_PITCH
shootSound.pitch = FlxG.random.float(0.9, 1.1);
#end
// Space bar was pressed! FIRE A BULLET
var playState:PlayState = cast FlxG.state;
var bullet:FlxSprite = playState.playerBullets.recycle();
Expand Down

0 comments on commit f947b8a

Please sign in to comment.