some stuff needs fixing

This commit is contained in:
Yoshman29
2022-10-13 13:45:32 +02:00
parent 44a6567b9c
commit 9db79167eb
3 changed files with 79 additions and 24 deletions
+16 -11
View File
@@ -71,8 +71,7 @@ class Alphabet extends FlxSpriteGroup
{
super(x, y);
_finalText = text;
this.text = text;
_finalText = this.text = text;
isBold = bold;
var alphabetPath = Paths.xml("alphabet");
@@ -117,24 +116,20 @@ class Alphabet extends FlxSpriteGroup
var xPos:Float = 0;
for (character in splitWords)
{
if (character == " " || character == "-")
lastWasSpace = true;
lastWasSpace = character == " ";
if (lastSprite != null)
xPos = lastSprite.x + lastSprite.width - x;
if (lastWasSpace)
{
xPos += 40;
lastWasSpace = false;
}
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
if (isBold)
letter.createBold(character);
else
letter.createLetter(character);
// anim not found
if (!letter.visible)
xPos += 40;
add(letter);
lastSprite = letter;
@@ -251,6 +246,8 @@ class Alphabet extends FlxSpriteGroup
override function update(elapsed:Float)
{
super.update(elapsed);
if (isMenuItem)
{
var scaledY = FlxMath.remapToRange(targetY, 0, 1, 0, 1.3);
@@ -259,7 +256,15 @@ class Alphabet extends FlxSpriteGroup
x = CoolUtil.fpsLerp(x, (targetY * 20) + 90, 0.16);
}
super.update(elapsed);
if (text != _finalText) {
_finalText = text;
for(e in members)
e.destroy();
@:privateAccess
group.members = [];
lastSprite = null;
addText();
}
}
}