Skip to content

Commit

Permalink
how tho
Browse files Browse the repository at this point in the history
  • Loading branch information
Joalor64GH authored Apr 12, 2024
1 parent 3e941b7 commit 49fa1cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
36 changes: 0 additions & 36 deletions source/HUD.hx

This file was deleted.

31 changes: 21 additions & 10 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ class PlayState extends BeatState
private var camHUD:FlxCamera;
private var camGame:FlxCamera;

public static var songScore:Int = 0;
public static var songMisses:Int = 0;
private var songScore:Int = 0;
private var songMisses:Int = 0;

var defaultCamZoom:Float = 1.05;

var ui:HUD;
private var scoreTxt:FlxText;
private var timeBar:Bar;

override public function create()
{
Expand Down Expand Up @@ -121,11 +122,20 @@ class PlayState extends BeatState

FlxG.fixedTimestep = false;

ui = new HUD();
add(ui);
scoreTxt = new FlxText(0, (FlxG.height * 0.89) + 36, FlxG.height, "Score: 0 // Misses: 0", 20);
scoreTxt.setFormat(Paths.font('vcr.ttf'), 48, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK);
scoreTxt.scrollFactor.set();
scoreTxt.screenCenter(X);
add(scoreTxt);

timeBar = new Bar(0, 0, FlxG.width, 10, FlxColor.WHITE, FlxColor.fromRGB(30, 144, 255));
timeBar.screenCenter(X);
timeBar.y = FlxG.height - 10;
add(timeBar);

strumLineNotes.cameras = [camHUD];
ui.cameras = [camHUD];
scoreTxt.cameras = [camHUD];
timeBar.cameras = [camHUD];

startingSong = true;
startCountdown();
Expand Down Expand Up @@ -429,7 +439,7 @@ class PlayState extends BeatState
perfectMode = false;
#end

ui.updateText();
scoreTxt.text = 'Score: $songScore // Misses: $songMisses';

super.update(elapsed);

Expand Down Expand Up @@ -460,6 +470,8 @@ class PlayState extends BeatState

if (!paused)
{
timeBar.value = (Conductor.songPosition / FlxG.sound.music.length);

songTime += FlxG.game.ticks - previousFrameTime;
previousFrameTime = FlxG.game.ticks;

Expand Down Expand Up @@ -563,9 +575,7 @@ class PlayState extends BeatState
else
{
if (daNote.tooLate || !daNote.wasGoodHit)
{
vocals.volume = 0;
}

daNote.active = false;
daNote.visible = false;
Expand All @@ -591,6 +601,7 @@ class PlayState extends BeatState
canPause = false;
FlxG.sound.music.volume = 0;
vocals.volume = 0;
trace("song finished");
Highscore.saveScore(SONG.song, songScore);
FlxG.switchState(new SongSelectState());
}
Expand Down Expand Up @@ -836,7 +847,7 @@ class PlayState extends BeatState

if (player.holdTimer > Conductor.stepCrochet * 4 * 0.001 && !up && !down && !right && !left)
{
if (player.animation.curAnim.name.startsWith('sing') && !player.animation.curAnim.name.endsWith('miss'))
if (player.animation.curAnim.name.startsWith('sing'))
player.playAnim('idle');
}

Expand Down

0 comments on commit 49fa1cc

Please # to comment.