Skip to content

Commit

Permalink
FlxSound.music + music cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chosencharacters committed Nov 30, 2024
1 parent 9e029d0 commit 5f9cc62
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ server
.ldtk-backups
assets/data/config/ng/ng-secrets.json
.vscode
/scripts/openssl
File renamed without changes.
File renamed without changes.
Binary file removed assets/music/rudolftehrednosereindeer_littlbox.mp3
Binary file not shown.
Binary file removed assets/music/sadgamertime_ninjamuffin99.mp3
Binary file not shown.
9 changes: 8 additions & 1 deletion source/SoundPlayer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import flixel.system.FlxAssets.FlxSoundAsset;
class SoundPlayer
{
public static var MUSIC_ALREADY_PLAYING:String = "";
public static var MUSIC_VOLUME:Float = .6;
public static var MUSIC_VOLUME:Float = 1;
public static var SOUND_VOLUME:Float = 1;

static var ran:FlxRandom;
Expand All @@ -19,6 +19,13 @@ class SoundPlayer
return return_sound;
}

public static function music(music_asset:String, vol:Float = 1)
{
music_asset = music_asset.replace(".ogg", "");
FlxG.sound.playMusic(Paths.get('${music_asset}.ogg'), MUSIC_VOLUME * vol);
return FlxG.sound.music;
}

static var slots:Array<Array<String>> = [];

static var alt_sounds:Map<String, Array<String>> = [];
Expand Down
4 changes: 2 additions & 2 deletions source/net/tankmas/TankmasClient.hx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package net.tankmas;
import net.core.Client;
import net.tankmas.NetDefs;


class TankmasClient
{
static var address:String = #if test_local 'http://127.0.0.1:5000' #else "http://78.108.218.30:25567" #end;
Expand All @@ -21,6 +20,7 @@ class TankmasClient

Client.post(url, user, on_complete);
}

public static function get_events(room_id:String, ?on_complete:Dynamic->Void)
{
var url:String = '$address/rooms/$room_id/events/get';
Expand All @@ -34,4 +34,4 @@ class TankmasClient

Client.post(url, event, on_complete);
}
}
}
8 changes: 6 additions & 2 deletions source/states/BaseState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@ class BaseState extends FlxState
FlxG.game.stage.quality = openfl.display.StageQuality.LOW;
// FlxG.stage.window.borderless = true;
FIRST_RUN = false;
//radio = new RadioManager();
FlxG.sound.playMusic(Paths.get('christmasohyeah_stixdevs.ogg'));

#if !no_radio
radio = new RadioManager();
#end

SoundPlayer.music(Paths.get('christmasohyeah-stixdevs.ogg'));
SaveManager.init();
}
else
Expand Down

0 comments on commit 5f9cc62

Please sign in to comment.