inis
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
; SONG INFO such as BPM, etc...
|
||||
; Use CoolUtil.playMusic() instead of FlxG.sound.playMusic()
|
||||
; for this file to have effect.
|
||||
BPM = 102
|
||||
@@ -0,0 +1,3 @@
|
||||
; SONG INFO such as BPM, etc...
|
||||
; Use CoolUtil.playMusic() instead of FlxG.sound.playMusic() for this file to have effect.
|
||||
BPM = 102
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1374
|
||||
1377
|
||||
@@ -1,5 +1,7 @@
|
||||
package funkin.game;
|
||||
|
||||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.system.FlxSound;
|
||||
import flixel.FlxG;
|
||||
import flixel.FlxObject;
|
||||
import flixel.FlxSubState;
|
||||
@@ -13,6 +15,8 @@ import funkin.system.Conductor;
|
||||
class GameOverSubstate extends MusicBeatSubstate
|
||||
{
|
||||
var bf:Character;
|
||||
public var character:String;
|
||||
public var gameOverSong:String;
|
||||
var camFollow:FlxObject;
|
||||
|
||||
var stageSuffix:String = "";
|
||||
@@ -20,43 +24,33 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
var x:Float = 0;
|
||||
var y:Float = 0;
|
||||
|
||||
public function new(x:Float, y:Float) {
|
||||
public var lossSFX:FlxSound;
|
||||
|
||||
public function new(x:Float, y:Float, character:String = "bf", gameOverSong:String = "gameOver") {
|
||||
super();
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.character = character;
|
||||
this.gameOverSong = gameOverSong;
|
||||
}
|
||||
|
||||
public override function create()
|
||||
{
|
||||
super.create();
|
||||
var daStage = PlayState.instance.curStage;
|
||||
var daBf:String = '';
|
||||
switch (daStage)
|
||||
{
|
||||
case 'school':
|
||||
stageSuffix = '-pixel';
|
||||
daBf = 'bf-pixel-dead';
|
||||
case 'schoolEvil':
|
||||
stageSuffix = '-pixel';
|
||||
daBf = 'bf-pixel-dead';
|
||||
default:
|
||||
daBf = 'bf';
|
||||
}
|
||||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
bf = new Character(x, y, daBf, true);
|
||||
bf = new Character(x, y, character, true);
|
||||
add(bf);
|
||||
|
||||
camFollow = new FlxObject(bf.getGraphicMidpoint().x, bf.getGraphicMidpoint().y, 1, 1);
|
||||
add(camFollow);
|
||||
FlxG.camera.target = camFollow;
|
||||
|
||||
FlxG.sound.play(Paths.sound('fnf_loss_sfx' + stageSuffix));
|
||||
lossSFX = FlxG.sound.play(Paths.sound('fnf_loss_sfx' + stageSuffix));
|
||||
Conductor.changeBPM(100);
|
||||
|
||||
// FlxG.camera.followLerp = 1;
|
||||
// FlxG.camera.focusOn(FlxPoint.get(FlxG.width / 2, FlxG.height / 2));
|
||||
FlxG.camera.scroll.set();
|
||||
FlxG.camera.target = null;
|
||||
|
||||
bf.danceOnBeat = false;
|
||||
bf.playAnim('firstDeath');
|
||||
}
|
||||
|
||||
@@ -71,7 +65,8 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
|
||||
if (controls.BACK)
|
||||
{
|
||||
FlxG.sound.music.stop();
|
||||
if (FlxG.sound.music != null)
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
if (PlayState.isStoryMode)
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
@@ -79,20 +74,15 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
FlxG.switchState(new FreeplayState());
|
||||
}
|
||||
|
||||
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.curFrame == 12)
|
||||
{
|
||||
FlxG.camera.follow(camFollow, LOCKON, 0.01);
|
||||
}
|
||||
|
||||
if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished)
|
||||
{
|
||||
FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix));
|
||||
}
|
||||
if (!lossSFX.playing && (FlxG.sound.music == null || !FlxG.sound.music.playing))
|
||||
CoolUtil.playMusic(Paths.music(gameOverSong), 100);
|
||||
}
|
||||
|
||||
override function beatHit(curBeat:Int)
|
||||
{
|
||||
super.beatHit(curBeat);
|
||||
if (!lossSFX.playing)
|
||||
bf.playAnim("deathLoop", DANCE);
|
||||
}
|
||||
|
||||
var isEnding:Bool = false;
|
||||
@@ -109,6 +99,7 @@ class GameOverSubstate extends MusicBeatSubstate
|
||||
{
|
||||
FlxG.camera.fade(FlxColor.BLACK, 2, false, function()
|
||||
{
|
||||
FlxTransitionableState.skipNextTransOut = true;
|
||||
FlxG.switchState(new PlayState());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1015,7 +1015,7 @@ class PlayState extends MusicBeatState
|
||||
vocals.stop();
|
||||
FlxG.sound.music.stop();
|
||||
|
||||
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
|
||||
openSubState(new GameOverSubstate(boyfriend.x, boyfriend.y));
|
||||
|
||||
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package funkin.system;
|
||||
|
||||
import flixel.system.FlxSoundGroup;
|
||||
import animateatlas.AtlasFrameMaker;
|
||||
import haxe.Json;
|
||||
import funkin.menus.StoryMenuState.WeekData;
|
||||
@@ -138,15 +139,29 @@ class CoolUtil
|
||||
public static function playMenuSong(fadeIn:Bool = false) {
|
||||
if (FlxG.sound.music == null || !FlxG.sound.music.playing)
|
||||
{
|
||||
Conductor.reset();
|
||||
|
||||
// TODO: bpm from config
|
||||
Conductor.changeBPM(102);
|
||||
FlxG.sound.playMusic(Paths.music('freakyMenu'), fadeIn ? 0 : 1);
|
||||
playMusic(Paths.music('freakyMenu'), 102, fadeIn ? 0 : 1);
|
||||
if (fadeIn)
|
||||
FlxG.sound.music.fadeIn(4, 0, 0.7);
|
||||
}
|
||||
}
|
||||
|
||||
public static function playMusic(path:String, DefaultBPM:Int = 102, Volume:Int = 1, Looped:Bool = true, ?Group:FlxSoundGroup) {
|
||||
Conductor.reset();
|
||||
FlxG.sound.playMusic(path, Volume, Looped, Group);
|
||||
|
||||
var infoPath = '${Path.withoutExtension(path)}.ini';
|
||||
if (Assets.exists(infoPath)) {
|
||||
var musicInfo = IniUtils.parseAsset(infoPath, [
|
||||
"BPM" => Std.string(DefaultBPM)
|
||||
]);
|
||||
var parsedBPM:Null<Float> = Std.parseFloat(musicInfo["BPM"]);
|
||||
if (parsedBPM == null)
|
||||
Conductor.changeBPM(102);
|
||||
else
|
||||
Conductor.changeBPM(parsedBPM);
|
||||
} else
|
||||
Conductor.changeBPM(102);
|
||||
}
|
||||
/**
|
||||
* Plays a specified Menu SFX.
|
||||
* @param menuSFX Menu SFX to play
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package funkin.system;
|
||||
|
||||
import openfl.utils.Assets;
|
||||
|
||||
/**
|
||||
* DOESNT SUPPORT CATEGORIES YET!!
|
||||
*/
|
||||
class IniUtils {
|
||||
public static inline function parseAsset(assetPath:String, ?defaultVariables:Map<String, String>)
|
||||
return parseString(Assets.getText(assetPath), defaultVariables);
|
||||
|
||||
public static function parseString(data:String, ?defaultVariables:Map<String, String>) {
|
||||
var trimmed:String;
|
||||
var splitContent = [for(e in data.split("\n")) if ((trimmed = e.trim()) != "") trimmed];
|
||||
|
||||
var finalMap:Map<String, String> = [];
|
||||
if (defaultVariables != null)
|
||||
for(k=>e in defaultVariables)
|
||||
finalMap[k] = e;
|
||||
|
||||
for(line in splitContent) {
|
||||
// comment
|
||||
if (line.startsWith(";")) continue;
|
||||
// categories; not supported yet
|
||||
if (line.startsWith("[") && line.endsWith("]")) continue;
|
||||
|
||||
var index = line.indexOf("=");
|
||||
var name = line.substr(0, index).trim();
|
||||
var value = line.substr(index+1).trim();
|
||||
|
||||
if (value.startsWith("\"") && value.endsWith("\""))
|
||||
value = value.substr(1, value.length - 2);
|
||||
|
||||
if (value.length == 0 || name.length == 0)
|
||||
continue;
|
||||
|
||||
finalMap[name] = value;
|
||||
}
|
||||
return finalMap;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user