added rows to alphabet

This commit is contained in:
Frakits
2024-04-24 21:12:52 +03:00
parent 30fbf0c1bc
commit d519db011a
+12 -1
View File
@@ -126,12 +126,16 @@ class Alphabet extends FlxSpriteGroup
doSplitWords();
var xPos:Float = 0;
for (character in splitWords)
var curRow:Int = 0;
for (i=>character in splitWords)
{
if (lastSprite != null)
xPos = lastSprite.x + lastSprite.width - x;
if (xPosResetted && !(xPosResetted = false)) xPos = 0;
var letter:AlphaCharacter = new AlphaCharacter(xPos, 0);
letter.row = curRow;
if (isBold)
letter.createBold(character);
else
@@ -145,6 +149,11 @@ class Alphabet extends FlxSpriteGroup
add(letter);
lastSprite = letter;
if (_finalText.fastCodeAt(i) == "\n".code)
{
xPosResetted = true;
curRow += 1;
}
}
}
@@ -251,6 +260,8 @@ class AlphaCharacter extends FlxSprite
animation.addByPrefix(letter, boldAnims[letter], 24);
animation.play(letter);
updateHitbox();
y += row * height;
}
public function createLetter(letter:String):Void