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 Etika
Foamymuffin (insert travis scott lyrics here) Foamymuffin (insert travis scott lyrics here)
SiIvaGunner SiIvaGunner
Masaya Matsuura
BIT BOY - MIKE WELSH BIT BOY - MIKE WELSH

View File

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

View File

@ -6,6 +6,13 @@ using StringTools;
class CoolUtil 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> public static function coolTextFile(path:String):Array<String>
{ {
var daList:Array<String> = Assets.getText(path).trim().split('\n'); var daList:Array<String> = Assets.getText(path).trim().split('\n');

View File

@ -1,123 +1,117 @@
package; package;
import openfl.utils.Assets as OpenFlAssets;
import openfl.utils.AssetType;
import flixel.FlxG; import flixel.FlxG;
import flixel.graphics.frames.FlxAtlasFrames; import flixel.graphics.frames.FlxAtlasFrames;
import openfl.utils.AssetType;
import openfl.utils.Assets as OpenFlAssets;
class Paths class Paths
{ {
inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end; inline public static var SOUND_EXT = #if web "mp3" #else "ogg" #end;
static var currentLevel:String; static var currentLevel:String;
static public function setCurrentLevel(name:String) static public function setCurrentLevel(name:String)
{ {
currentLevel = name.toLowerCase(); currentLevel = name.toLowerCase();
} }
static function getPath(file:String, type:AssetType, library:Null<String>) static function getPath(file:String, type:AssetType, library:Null<String>)
{ {
if (library != null) if (library != null)
return getLibraryPath(file, library); return getLibraryPath(file, library);
if (currentLevel != null) if (currentLevel != null)
{ {
var levelPath = getLibraryPathForce(file, currentLevel); var levelPath = getLibraryPathForce(file, currentLevel);
if (OpenFlAssets.exists(levelPath, type)) if (OpenFlAssets.exists(levelPath, type))
return levelPath; return levelPath;
levelPath = getLibraryPathForce(file, "shared"); levelPath = getLibraryPathForce(file, "shared");
if (OpenFlAssets.exists(levelPath, type)) if (OpenFlAssets.exists(levelPath, type))
return levelPath; return levelPath;
} }
return getPreloadPath(file); return getPreloadPath(file);
} }
static public function getLibraryPath(file:String, library = "preload") static public function getLibraryPath(file:String, library = "preload")
{ {
return if (library == "preload" || library == "default") return if (library == "preload" || library == "default") getPreloadPath(file); else getLibraryPathForce(file, library);
getPreloadPath(file);
else
getLibraryPathForce(file, library);
} }
inline static function getLibraryPathForce(file:String, library:String) inline static function getLibraryPathForce(file:String, library:String)
{ {
return '$library:assets/$library/$file'; return '$library:assets/$library/$file';
} }
inline static function getPreloadPath(file:String) inline static function getPreloadPath(file:String)
{ {
return 'assets/$file'; return 'assets/$file';
} }
inline static public function file(file:String, type:AssetType = TEXT, ?library:String) inline static public function file(file:String, type:AssetType = TEXT, ?library:String)
{ {
return getPath(file, type, library); return getPath(file, type, library);
} }
inline static public function txt(key:String, ?library:String) inline static public function txt(key:String, ?library:String)
{ {
return getPath('data/$key.txt', TEXT, library); return getPath('data/$key.txt', TEXT, library);
} }
inline static public function xml(key:String, ?library:String) inline static public function xml(key:String, ?library:String)
{ {
return getPath('data/$key.xml', TEXT, library); return getPath('data/$key.xml', TEXT, library);
} }
inline static public function json(key:String, ?library:String) inline static public function json(key:String, ?library:String)
{ {
return getPath('data/$key.json', TEXT, library); 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); return getPath('sounds/$key.$SOUND_EXT', SOUND, library);
} }
inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String) inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String)
{ {
return sound(key + FlxG.random.int(min, max), library); return sound(key + FlxG.random.int(min, max), library);
} }
inline static public function music(key:String, ?library:String) inline static public function music(key:String, ?library:String)
{ {
return getPath('music/$key.$SOUND_EXT', MUSIC, library); return getPath('music/$key.$SOUND_EXT', MUSIC, library);
} }
inline static public function voices(song:String) inline static public function voices(song:String)
{ {
return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT'; return 'songs:assets/songs/${song.toLowerCase()}/Voices.$SOUND_EXT';
} }
inline static public function inst(song:String) inline static public function inst(song:String)
{ {
return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT'; return 'songs:assets/songs/${song.toLowerCase()}/Inst.$SOUND_EXT';
} }
inline static public function image(key:String, ?library:String) inline static public function image(key:String, ?library:String)
{ {
return getPath('images/$key.png', IMAGE, library); return getPath('images/$key.png', IMAGE, library);
} }
inline static public function font(key:String) inline static public function font(key:String)
{ {
return 'assets/fonts/$key'; return 'assets/fonts/$key';
} }
inline static public function getSparrowAtlas(key:String, ?library:String) inline static public function getSparrowAtlas(key:String, ?library:String)
{ {
return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)); return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library));
} }
inline static public function getPackerAtlas(key:String, ?library:String) inline static public function getPackerAtlas(key:String, ?library:String)
{ {
return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library)); 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.group.FlxGroup.FlxTypedGroup;
import flixel.input.keyboard.FlxKey; import flixel.input.keyboard.FlxKey;
import flixel.system.FlxSound; import flixel.system.FlxSound;
import flixel.text.FlxText;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import flixel.util.FlxColor; import flixel.util.FlxColor;
class PauseSubState extends MusicBeatSubstate class PauseSubState extends MusicBeatSubstate
@ -30,10 +33,24 @@ class PauseSubState extends MusicBeatSubstate
FlxG.sound.list.add(pauseMusic); FlxG.sound.list.add(pauseMusic);
var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK);
bg.alpha = 0.6; bg.alpha = 0;
bg.scrollFactor.set(); bg.scrollFactor.set();
add(bg); 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>(); grpMenuShit = new FlxTypedGroup<Alphabet>();
add(grpMenuShit); add(grpMenuShit);