From 662711b78717005750b005502df16325e78ffcdf Mon Sep 17 00:00:00 2001 From: MtH Date: Thu, 8 Apr 2021 23:29:31 +0200 Subject: [PATCH] freeplay --- source/FreeplayState.hx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 31c66971a..a64893bb2 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -36,6 +36,7 @@ class FreeplayState extends MusicBeatState private var iconArray:Array = []; var bg:FlxSprite; + var scoreBG:FlxSprite; override function create() { @@ -118,7 +119,8 @@ class FreeplayState extends MusicBeatState scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT); // scoreText.alignment = RIGHT; - var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.3), 66, 0xFF000000); + scoreBG = new FlxSprite(scoreText.x - 6, 0).makeGraphic(1, 66, 0xFF000000); + scoreBG.antialiasing = false; scoreBG.alpha = 0.6; add(scoreBG); @@ -201,6 +203,8 @@ class FreeplayState extends MusicBeatState scoreText.text = "PERSONAL BEST:" + lerpScore; + positionHighscore(); + var upP = controls.UI_UP_P; var downP = controls.UI_DOWN_P; var accepted = controls.ACCEPT; @@ -254,8 +258,7 @@ class FreeplayState extends MusicBeatState PlayState.storyDifficulty = curDifficulty; diffText.text = "< " + CoolUtil.difficultyString() + " >"; - diffText.x = FlxG.width * 0.85; - diffText.x -= (diffText.width / 2); + positionHighscore(); } function changeSelection(change:Int = 0) @@ -305,6 +308,16 @@ class FreeplayState extends MusicBeatState } } } + + function positionHighscore() + { + scoreText.x = FlxG.width - scoreText.width - 6; + scoreBG.scale.x = FlxG.width - scoreText.x + 6; + scoreBG.x = FlxG.width - scoreBG.scale.x / 2; + + diffText.x = Std.int(scoreBG.x + scoreBG.width / 2); + diffText.x -= (diffText.width / 2); + } } class SongMetadata