diff --git a/CHANGELOG.md b/CHANGELOG.md index 84ecd5f0f..017b7bb07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [UNRELEASED] +### Added +- Different icons depending on which character you are against ### Fixed - Crash when playing Week 3 and then playing a non-week 3 song - When pausing music at the start, it doesn't continue the song anyways. ([shoutouts gedehari for the Pull Request!](https://github.com/ninjamuffin99/Funkin/pull/48)) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 7c45fb287..ede087ed8 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -12,7 +12,7 @@ import lime.utils.Assets; class FreeplayState extends MusicBeatState { - var songs:Array = ["Bopeebo", "Dadbattle", "Fresh", "Tutorial"]; + var songs:Array = ["Milf", "Bopeebo", "Dadbattle", "Fresh", "Tutorial"]; var selector:FlxText; var curSelected:Int = 0; diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx new file mode 100644 index 000000000..b5be951f5 --- /dev/null +++ b/source/HealthIcon.hx @@ -0,0 +1,25 @@ +package; + +import flixel.FlxSprite; + +class HealthIcon extends FlxSprite +{ + public function new(char:String = 'bf', isPlayer:Bool = false) + { + super(); + + loadGraphic(AssetPaths.iconGrid__png, true, 150, 150); + + antialiasing = true; + animation.add('bf', [0, 1], 0, false, isPlayer); + animation.add('spooky', [2, 3], 0, false, isPlayer); + animation.add('pico', [4, 5], 0, false, isPlayer); + animation.add('mom', [6, 7], 0, false, isPlayer); + animation.add('tankman', [8, 9], 0, false, isPlayer); + animation.add('face', [10, 11], 0, false, isPlayer); + animation.add('dad', [12, 13], 0, false, isPlayer); + animation.add('bf-old', [14, 15], 0, false, isPlayer); + animation.play(char); + scrollFactor.set(); + } +} diff --git a/source/PlayState.hx b/source/PlayState.hx index b16591b10..d4a6307df 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -73,7 +73,8 @@ class PlayState extends MusicBeatState private var generatedMusic:Bool = false; private var startingSong:Bool = false; - private var healthHeads:FlxSprite; + private var iconP1:HealthIcon; + private var iconP2:HealthIcon; private var camHUD:FlxCamera; private var camGame:FlxCamera; @@ -309,17 +310,14 @@ class PlayState extends MusicBeatState scoreTxt.scrollFactor.set(); add(scoreTxt); - healthHeads = new FlxSprite(); - var headTex = FlxAtlasFrames.fromSparrow(AssetPaths.healthHeads__png, AssetPaths.healthHeads__xml); - healthHeads.frames = headTex; - healthHeads.animation.add('healthy', [0]); - healthHeads.animation.add('unhealthy', [1]); - healthHeads.y = healthBar.y - (healthHeads.height / 2); - healthHeads.scrollFactor.set(); - healthHeads.antialiasing = true; - add(healthHeads); + iconP1 = new HealthIcon(SONG.player1, true); + iconP1.y = healthBar.y - (iconP1.height / 2); + add(iconP1); + + iconP2 = new HealthIcon(SONG.player2, false); + iconP2.y = healthBar.y - (iconP2.height / 2); + add(iconP2); - // healthBar.visible = healthHeads.visible = healthBarBG.visible = false; if (isStoryMode) { // TEMP for now, later get rid of startCountdown() @@ -333,7 +331,8 @@ class PlayState extends MusicBeatState notes.cameras = [camHUD]; healthBar.cameras = [camHUD]; healthBarBG.cameras = [camHUD]; - healthHeads.cameras = [camHUD]; + iconP1.cameras = [camHUD]; + iconP2.cameras = [camHUD]; scoreTxt.cameras = [camHUD]; doof.cameras = [camHUD]; @@ -663,8 +662,10 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.NINE) { - perfectMode = !perfectMode; - trace('PERFECT MODE! ' + perfectMode); + if (iconP1.animation.curAnim.name == 'bf-old') + iconP1.animation.play(SONG.player1); + else + iconP1.animation.play('bf-old'); } switch (curStage) @@ -705,17 +706,24 @@ class PlayState extends MusicBeatState // FlxG.watch.addQuick('VOL', vocals.amplitudeLeft); // FlxG.watch.addQuick('VOLRight', vocals.amplitudeRight); - healthHeads.setGraphicSize(Std.int(FlxMath.lerp(150, healthHeads.width, 0.50))); - healthHeads.updateHitbox(); - healthHeads.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (healthHeads.width / 2); + iconP1.setGraphicSize(Std.int(FlxMath.lerp(150, iconP1.width, 0.50))); + iconP2.setGraphicSize(Std.int(FlxMath.lerp(150, iconP2.width, 0.50))); + + iconP1.updateHitbox(); + iconP2.updateHitbox(); + + var iconOffset:Int = 26; + + iconP1.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01) - iconOffset); + iconP2.x = healthBar.x + (healthBar.width * (FlxMath.remapToRange(healthBar.percent, 0, 100, 100, 0) * 0.01)) - (iconP2.width - iconOffset); if (health > 2) health = 2; if (healthBar.percent < 20) - healthHeads.animation.play('unhealthy'); + iconP1.animation.curAnim.curFrame = 1; else - healthHeads.animation.play('healthy'); + iconP1.animation.curAnim.curFrame = 0; /* if (FlxG.keys.justPressed.NINE) FlxG.switchState(new Charting()); */ @@ -914,7 +922,7 @@ class PlayState extends MusicBeatState daNote.destroy(); } - daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); + daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * (0.45 * FlxMath.roundDecimal(PlayState.SONG.speed, 2))); // WIP interpolation shit? Need to fix the pause issue // daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); @@ -1526,8 +1534,11 @@ class PlayState extends MusicBeatState camHUD.zoom += 0.03; } - healthHeads.setGraphicSize(Std.int(healthHeads.width + 30)); - healthHeads.updateHitbox(); + iconP1.setGraphicSize(Std.int(iconP1.width + 30)); + iconP2.setGraphicSize(Std.int(iconP2.width + 30)); + + iconP1.updateHitbox(); + iconP2.updateHitbox(); if (totalBeats % gfSpeed == 0) {