From d306ee9ec3b4f6c212877030d76b0dc573239483 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 17 Nov 2020 17:32:38 -0800 Subject: [PATCH] score on song --- CHANGELOG.md | 2 ++ source/PlayState.hx | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 017b822..32f3c30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Music playing on the freeplay menu. - UI sounds on freeplay menu +- Score now shows mid-song. + ### Changed - Moved all the intro texts to its own txt file instead of being hardcoded, this allows for much easier customization. File is in the data folder, called "introText.txt", follow the format in there and you're probably good to go! ### Fixed diff --git a/source/PlayState.hx b/source/PlayState.hx index 7d561b7..7129728 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -83,6 +83,7 @@ class PlayState extends MusicBeatState var talking:Bool = true; var songScore:Int = 0; + var scoreTxt:FlxText; public static var campaignScore:Int = 0; @@ -252,6 +253,11 @@ class PlayState extends MusicBeatState // healthBar add(healthBar); + scoreTxt = new FlxText(healthBarBG.x + healthBarBG.width - 190, healthBarBG.y + 30, 0, "", 20); + scoreTxt.setFormat("assets/fonts/vcr.ttf", 16, FlxColor.WHITE, RIGHT); + scoreTxt.scrollFactor.set(); + add(scoreTxt); + healthHeads = new FlxSprite(); var headTex = FlxAtlasFrames.fromSparrow(AssetPaths.healthHeads__png, AssetPaths.healthHeads__xml); healthHeads.frames = headTex; @@ -277,6 +283,7 @@ class PlayState extends MusicBeatState healthBar.cameras = [camHUD]; healthBarBG.cameras = [camHUD]; healthHeads.cameras = [camHUD]; + scoreTxt.cameras = [camHUD]; doof.cameras = [camHUD]; // if (SONG.song == 'South') @@ -586,6 +593,8 @@ class PlayState extends MusicBeatState { super.update(elapsed); + scoreTxt.text = "Score:" + songScore; + if (FlxG.keys.justPressed.ENTER && startedCountdown) { persistentUpdate = false;