diff --git a/assets/data/characters/bf.hx b/assets/data/characters/bf.hx deleted file mode 100644 index 2ef5ef2e..00000000 --- a/assets/data/characters/bf.hx +++ /dev/null @@ -1,23 +0,0 @@ -trace("Hello, World!"); - -function createPost() { - globalOffset.y -= 150; -} - -function update(elapsed:Float) { - y = y + Math.sin(Conductor.songPosition / 1000 * Math.PI) * 125 * elapsed; -} - -function onGetCamPos(deezNuts:Dynamic) { - if (animation.curAnim == null) return; - switch(animation.curAnim.name) { - case "singUP": - deezNuts.y -= 25; - case "singDOWN": - deezNuts.y += 25; - case "singLEFT": - deezNuts.x -= 25; - case "singRIGHT": - deezNuts.x += 25; - } -} \ No newline at end of file diff --git a/buildnumber.txt b/buildnumber.txt index 1a7d3a1c..95738485 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -318 \ No newline at end of file +326 \ No newline at end of file diff --git a/docs/doc.xml b/docs/doc.xml index 67648c62..7169948e 100644 --- a/docs/doc.xml +++ b/docs/doc.xml @@ -22887,9 +22887,9 @@ - <__touch get="inline" set="null" expr=""1.66548851e+012"" line="22" static="1"> + <__touch get="inline" set="null" expr=""1.665501631e+012"" line="22" static="1"> - "1.66548851e+012" + "1.665501631e+012" diff --git a/source/funkin/game/Character.hx b/source/funkin/game/Character.hx index 1d5d7b34..03bd9544 100644 --- a/source/funkin/game/Character.hx +++ b/source/funkin/game/Character.hx @@ -52,6 +52,7 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom public var globalOffset:FlxPoint = new FlxPoint(0, 0); public var script:Script; + public var xml:Access; public inline function getCameraPosition() { var midpoint = getMidpoint(); @@ -97,29 +98,28 @@ class Character extends FlxSprite implements IBeatReceiver implements IOffsetCom } var plainXML = Assets.getText(xmlPath); - var character:Access; try { var charXML = Xml.parse(plainXML).firstElement(); if (charXML == null) throw new Exception("Missing \"character\" node in XML."); - character = new Access(charXML); + xml = new Access(charXML); } catch(e) { trace(e); curCharacter = "bf"; continue; } - if (character.has.isPlayer) playerOffsets = (character.att.isPlayer == "true"); - if (character.has.isGF) isGF = (character.att.isGF == "true"); - if (character.has.x) globalOffset.x = Std.parseFloat(character.att.x); - if (character.has.y) globalOffset.y = Std.parseFloat(character.att.y); - if (character.has.camx) cameraOffset.x = Std.parseFloat(character.att.camx); - if (character.has.camy) cameraOffset.y = Std.parseFloat(character.att.camy); - if (character.has.holdTime) holdTime = CoolUtil.getDefault(Std.parseFloat(character.att.holdTime), 4); - if (character.has.flipX) flipX = (character.att.flipX == "true"); - if (character.has.icon) icon = character.att.icon; + if (xml.has.isPlayer) playerOffsets = (xml.att.isPlayer == "true"); + if (xml.has.isGF) isGF = (xml.att.isGF == "true"); + if (xml.has.x) globalOffset.x = Std.parseFloat(xml.att.x); + if (xml.has.y) globalOffset.y = Std.parseFloat(xml.att.y); + if (xml.has.camx) cameraOffset.x = Std.parseFloat(xml.att.camx); + if (xml.has.camy) cameraOffset.y = Std.parseFloat(xml.att.camy); + if (xml.has.holdTime) holdTime = CoolUtil.getDefault(Std.parseFloat(xml.att.holdTime), 4); + if (xml.has.flipX) flipX = (xml.att.flipX == "true"); + if (xml.has.icon) icon = xml.att.icon; frames = Paths.getSparrowAtlas('characters/$curCharacter'); - for(anim in character.nodes.anim) { + for(anim in xml.nodes.anim) { XMLUtil.addXMLAnimation(this, anim); } diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 36807105..187a573b 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -106,6 +106,7 @@ class PlayState extends MusicBeatState public var health:Float = 1; public var combo:Int = 0; + public var comboBreaks:Bool = false; public var healthBarBG:FlxSprite; public var healthBar:FlxBar; @@ -119,6 +120,7 @@ class PlayState extends MusicBeatState public var songScore:Int = 0; + public var misses:Int = 0; public var scoreTxt:FlxText; public static var campaignScore:Int = 0; @@ -789,7 +791,7 @@ class PlayState extends MusicBeatState super.update(elapsed); scripts.call("update", [elapsed]); - scoreTxt.text = "Score:" + songScore; + scoreTxt.text = 'Score:$songScore\n${comboBreaks ? "Combo Breaks" : "Misses"}:$misses'; if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) pauseGame(); @@ -1324,6 +1326,7 @@ class PlayState extends MusicBeatState combo = 0; songScore -= 10; + misses++; FlxG.sound.play(Paths.soundRandom('missnote', 1, 3), FlxG.random.float(0.1, 0.2)); // FlxG.sound.play(Paths.sound('missnote1'), 1, false); diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index afe83379..08fe6cce 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -117,7 +117,8 @@ class Stage extends FlxBasic implements IBeatReceiver { } if (sprite != null) { for(e in node.nodes.property) { - trace(XMLUtil.applyXMLProperty(sprite, e)); + // TODO: Proper logging system + XMLUtil.applyXMLProperty(sprite, e); } } } diff --git a/source/funkin/system/CoolUtil.hx b/source/funkin/system/CoolUtil.hx index f1ee8515..e72d2b01 100644 --- a/source/funkin/system/CoolUtil.hx +++ b/source/funkin/system/CoolUtil.hx @@ -26,47 +26,16 @@ class CoolUtil return FlxMath.lerp(v1, v2, getFPSRatio(ratio)); } /** - * Lerps from color1 into color2 in a cool way 😎 + * Lerps from color1 into color2 (Shortcut to `FlxColor.interpolate`) * @param color1 Color 1 * @param color2 Color 2 * @param ratio Ratio * @param fpsSensitive Whenever the ratio should be case sentivive (adapted when game is running at 120 instead of 60) */ public static function lerpColor(color1:FlxColor, color2:FlxColor, ratio:Float, fpsSensitive:Bool = false) { - var h1 = color1.hue; - var s1 = color1.saturation; - var b1 = color1.brightness; - - var h2 = color2.hue; - var s2 = color2.saturation; - var b2 = color2.brightness; - if (!fpsSensitive) ratio = getFPSRatio(ratio); - - if (Math.abs(h1-h2) > 180) h1 += 360; - - if (Math.abs(h1 - h2) > 180 || (s2 < 0.125 || s1 < 0.125)) { - // classic r,g,b lerp - var r1 = color1.redFloat; - var g1 = color1.greenFloat; - var b1 = color1.blueFloat; - - var r2 = color2.redFloat; - var g2 = color2.greenFloat; - var b2 = color2.blueFloat; - - return FlxColor.fromRGBFloat( - FlxMath.lerp(r1, r2, ratio), - FlxMath.lerp(g1, g2, ratio), - FlxMath.lerp(b1, b2, ratio)); - } - - - return FlxColor.fromHSB( - FlxMath.lerp(h1, h2, ratio), - FlxMath.lerp(s1, s2, ratio), - FlxMath.lerp(b1, b2, ratio)); + return FlxColor.interpolate(color1, color2, ratio); } /**