pause screen polish shit

This commit is contained in:
Cameron Taylor 2021-03-01 23:00:02 -05:00
parent a6a3db6aa4
commit e26b5f4cda
5 changed files with 84 additions and 66 deletions

View File

@ -18,5 +18,6 @@ bbpanzu
Etika
Foamymuffin (insert travis scott lyrics here)
SiIvaGunner
Masaya Matsuura
BIT BOY - MIKE WELSH

View File

@ -1,8 +1,8 @@
package;
import Conductor.BPMChangeEvent;
import Section.SwagSection;
import Song.SwagSong;
import Conductor.BPMChangeEvent;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.addons.display.FlxGridOverlay;
@ -447,21 +447,21 @@ class ChartingState extends MusicBeatState
var updatedSection:Bool = false;
/* this function got owned LOL
function lengthBpmBullshit():Float
{
if (_song.notes[curSection].changeBPM)
return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm);
else
return _song.notes[curSection].lengthInSteps;
function lengthBpmBullshit():Float
{
if (_song.notes[curSection].changeBPM)
return _song.notes[curSection].lengthInSteps * (_song.notes[curSection].bpm / _song.bpm);
else
return _song.notes[curSection].lengthInSteps;
}*/
function sectionStartTime():Float
{
var daBPM:Int = _song.bpm;
var daPos:Float = 0;
for (i in 0...curSection)
{
if (_song.notes[i].changeBPM) {
if (_song.notes[i].changeBPM)
{
daBPM = _song.notes[i].bpm;
}
daPos += 4 * (1000 * 60 / daBPM);
@ -744,11 +744,11 @@ class ChartingState extends MusicBeatState
vocals.pause();
/*var daNum:Int = 0;
var daLength:Float = 0;
while (daNum <= sec)
{
daLength += lengthBpmBullshit();
daNum++;
var daLength:Float = 0;
while (daNum <= sec)
{
daLength += lengthBpmBullshit();
daNum++;
}*/
FlxG.sound.music.time = sectionStartTime();
@ -830,7 +830,7 @@ class ChartingState extends MusicBeatState
}
else
{
//get last bpm
// get last bpm
var daBPM:Int = _song.bpm;
for (i in 0...curSection)
if (_song.notes[i].changeBPM)
@ -975,29 +975,28 @@ class ChartingState extends MusicBeatState
}
/*
function calculateSectionLengths(?sec:SwagSection):Int
{
var daLength:Int = 0;
for (i in _song.notes)
function calculateSectionLengths(?sec:SwagSection):Int
{
var swagLength = i.lengthInSteps;
var daLength:Int = 0;
if (i.typeOfSection == Section.COPYCAT)
swagLength * 2;
daLength += swagLength;
if (sec != null && sec == i)
for (i in _song.notes)
{
trace('swag loop??');
break;
var swagLength = i.lengthInSteps;
if (i.typeOfSection == Section.COPYCAT)
swagLength * 2;
daLength += swagLength;
if (sec != null && sec == i)
{
trace('swag loop??');
break;
}
}
}
return daLength;
return daLength;
}*/
private var daSpacing:Float = 0.3;
function loadLevel():Void

View File

@ -6,6 +6,13 @@ using StringTools;
class CoolUtil
{
public static var difficultyArray:Array<String> = ['EASY', "NORMAL", "HARD"];
public static function difficultyString():String
{
return difficultyArray[PlayState.storyDifficulty];
}
public static function coolTextFile(path:String):Array<String>
{
var daList:Array<String> = Assets.getText(path).trim().split('\n');

View File

@ -1,123 +1,117 @@
package;
import openfl.utils.Assets as OpenFlAssets;
import openfl.utils.AssetType;
import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames;
import openfl.utils.AssetType;
import openfl.utils.Assets as OpenFlAssets;
class Paths
{
inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
static var currentLevel:String;
static public function setCurrentLevel(name:String)
{
currentLevel = name.toLowerCase();
}
static function getPath(file:String, type:AssetType, library:Null<String>)
{
if (library != null)
return getLibraryPath(file, library);
if (currentLevel != null)
{
var levelPath = getLibraryPathForce(file, currentLevel);
if (OpenFlAssets.exists(levelPath, type))
return levelPath;
levelPath = getLibraryPathForce(file, "shared");
if (OpenFlAssets.exists(levelPath, type))
return levelPath;
}
return getPreloadPath(file);
}
static public function getLibraryPath(file:String, library = "preload")
{
return if (library == "preload" || library == "default")
getPreloadPath(file);
else
getLibraryPathForce(file, library);
return if (library == "preload" || library == "default") getPreloadPath(file); else getLibraryPathForce(file, library);
}
inline static function getLibraryPathForce(file:String, library:String)
{
return '$library:assets/$library/$file';
}
inline static function getPreloadPath(file:String)
{
return 'assets/$file';
}
inline static public function file(file:String, type:AssetType = TEXT, ?library:String)
{
return getPath(file, type, library);
}
inline static public function txt(key:String, ?library:String)
{
return getPath('data/$key.txt', TEXT, library);
}
inline static public function xml(key:String, ?library:String)
{
return getPath('data/$key.xml', TEXT, library);
}
inline static public function json(key:String, ?library:String)
{
return getPath('data/$key.json', TEXT, library);
}
static public function sound(key:String, ?library:String)
static public function sound(key:String, ?library:String)
{
return getPath('sounds/$key.$SOUND_EXT', SOUND, library);
}
inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String)
{
return sound(key + FlxG.random.int(min, max), library);
}
inline static public function music(key:String, ?library:String)
{
return getPath('music/$key.$SOUND_EXT', MUSIC, library);
}
inline static public function voices(song:String)
{
return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT';
}
inline static public function inst(song:String)
{
return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT';
}
inline static public function image(key:String, ?library:String)
{
return getPath('images/$key.png', IMAGE, library);
}
inline static public function font(key:String)
{
return 'assets/fonts/$key';
}
inline static public function getSparrowAtlas(key:String, ?library:String)
{
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
}
inline static public function getPackerAtlas(key:String, ?library:String)
{
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library));
}
}
}

View File

@ -8,6 +8,9 @@ import flixel.addons.transition.FlxTransitionableState;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.input.keyboard.FlxKey;
import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
class PauseSubState extends MusicBeatSubstate
@ -30,10 +33,24 @@ class PauseSubState extends MusicBeatSubstate
FlxG.sound.list.add(pauseMusic);
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.alpha = 0.6;
bg.alpha = 0;
bg.scrollFactor.set();
add(bg);
var levelInfo:FlxText = new FlxText(20, 15, 0, "", 32);
levelInfo.text += PlayState.SONG.song;
levelInfo.text += '\n' + CoolUtil.difficultyString();
levelInfo.scrollFactor.set();
levelInfo.setFormat(Paths.font("vcr.ttf"), 32);
levelInfo.updateHitbox();
add(levelInfo);
levelInfo.alpha = 0;
levelInfo.x = FlxG.width - (levelInfo.width + 20);
FlxTween.tween(bg, {alpha: 0.6}, 0.4, {ease: FlxEase.quartInOut});
FlxTween.tween(levelInfo, {alpha: 1, y: 20}, 0.4, {ease: FlxEase.quartInOut, startDelay: 0.3});
grpMenuShit = new FlxTypedGroup<Alphabet>();
add(grpMenuShit);