ThatRozebudDude / FPS-Plus-Public

Other
102 stars 103 forks source link

Alphabet.hx corruption when I try to make it go to the center #64

Closed OfficialJSCD-Git closed 6 months ago

OfficialJSCD-Git commented 6 months ago

image

I modified Alphabet.hx to make the letters go to the center.

ThatRozebudDude commented 6 months ago

Can you provide the modified code?

OfficialJSCD-Git commented 6 months ago

yeah sure

package;

import flixel.FlxG; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxSpriteGroup; import flixel.math.FlxMath; import flixel.util.FlxTimer;

using StringTools;

/**

class AlphaCharacter extends FlxSprite { public static var alphabet:String = "abcdefghijklmnopqrstuvwxyz";

public static var numbers:String = "1234567890";

public static var symbols:String = "|~#$%()*+-:;<=>@[]^_.,'!?";

public var row:Int = 0;

public function new(x:Float, y:Float)
{
    super(x, y);
    var tex = Paths.getSparrowAtlas("alphabet");
    frames = tex;

    antialiasing = true;
}

public function createBold(letter:String)
{
    animation.addByPrefix(letter, letter.toUpperCase() + " bold", 24);
    animation.play(letter);
    updateHitbox();
}

public function createLetter(letter:String):Void
{
    var letterCase:String = "lowercase";
    if (letter.toLowerCase() != letter)
    {
        letterCase = 'capital';
    }

    animation.addByPrefix(letter, letter + " " + letterCase, 24);
    animation.play(letter);
    updateHitbox();

    FlxG.log.add('the row' + row);

    y = (110 - height);
    y += row * 60;
}

public function createNumber(letter:String):Void
{
    animation.addByPrefix(letter, letter, 24);
    animation.play(letter);

    updateHitbox();
}

public function createSymbol(letter:String)
{
    switch (letter)
    {
        case '.':
            animation.addByPrefix(letter, 'period', 24);
            animation.play(letter);
            y += 50;
        case "'":
            animation.addByPrefix(letter, 'apostraphie', 24);
            animation.play(letter);
            y -= 0;
        case "?":
            animation.addByPrefix(letter, 'question mark', 24);
            animation.play(letter);
        case "!":
            animation.addByPrefix(letter, 'exclamation point', 24);
            animation.play(letter);
    }

    updateHitbox();
}

}

ThatRozebudDude commented 6 months ago

I copied the part of the code that repositions the x value to the center and it seemed to work fine for me. I don't know if you changed anything else except for that part but I suggest just going back to the original Alphabet.hx and re-implementing the code that changes the x position.

Also, you should send code in a code block forward going. It makes it more readable and prevents it from having markdown formatting applied to it.

OfficialJSCD-Git commented 6 months ago

ze files.zip these are the files causing the issue

OfficialJSCD-Git commented 6 months ago

nevermind, i fixed the issue