https://linen.dev logo
Join Discord
Powered by
# flixel
  • h

    hallowed-ocean-84954

    02/22/2023, 4:51 AM
    restarting vscode cleaned it - there is something somewhere
  • a

    ambitious-knife-25690

    02/22/2023, 5:09 AM
    post this in #459827960006967325
  • t

    tall-teacher-57409

    02/22/2023, 11:00 AM
    quick question: how do you again use live server with flixel (vscode)
  • a

    ambitious-knife-25690

    02/22/2023, 12:01 PM
    there's a guide in the pins
  • t

    tall-teacher-57409

    02/22/2023, 12:03 PM
    yeah I saw it, ty
  • i

    important-egg-61899

    02/22/2023, 1:55 PM
    I'm making a test with sonic sprites and when I move the animations work! But the second time when I move after losing all of my acceleration, the animation gets stuck on the first frame, until you go fast enough and the animation switches.
  • i

    important-egg-61899

    02/22/2023, 1:57 PM
    I think it's with my update function
    message
  • w

    witty-island-52596

    02/22/2023, 1:59 PM
    Post relevant code using code tags, not a .txt we have to download
  • i

    important-egg-61899

    02/22/2023, 1:59 PM
    mb
  • i

    important-egg-61899

    02/22/2023, 1:59 PM
    it doesn't let me post the code
  • i

    important-egg-61899

    02/22/2023, 2:00 PM
    it's too long
  • i

    important-egg-61899

    02/22/2023, 2:00 PM
    Copy code
    haxe
    if (FlxG.keys.justPressed.I)
            {
                trace("speed: " + char.speed);
                trace("velocity.x: " + char.velocity.x);
                trace("sonic framerate: " + char.animation.curAnim.frameRate);
                trace("sonic anim name: " + char.animation.curAnim.name);
            }
            //        walkingFrame = char.animation.curAnim.curFrame;
            char.origin.set(char.width / 2, char.height);
            char.speed = char.velocity.x / 2;
            char.animation.curAnim.frameRate = flixel.math.FlxMath.absInt(Std.int(char.speed)) / 1.5;
            if (flixel.math.FlxMath.absInt(Std.int(char.speed)) > 40 && char.animation.curAnim.name == 'walk')
            {
                char.playAnim('run');
            }
            if (flixel.math.FlxMath.absInt(Std.int(char.speed)) < 40 && char.animation.curAnim.name == 'run')
            {
                char.playAnim('walk');
            }
    
            if (FlxG.keys.justPressed.A || FlxG.keys.justPressed.D)
            {
                timeWalking = 0;
                char.playAnim('walk');
                trace('walk');
            }
            if (FlxG.keys.pressed.W)
            {
                char.playAnim('up');
            }
            else if (FlxG.keys.pressed.S)
            {
                char.playAnim('down');
            }
            if (FlxG.keys.pressed.D)
            {
                char.flipX = false;
                if (timeWalking == 0)
                    char.velocity.x += 2;
                else
                    char.velocity.x += 1;
                timeWalking += 1;
            }
            else if (FlxG.keys.pressed.A)
            {
                char.flipX = true;
                if (timeWalking == 0)
                    char.velocity.x -= 2;
                else
                    char.velocity.x -= 1;
                timeWalking += 1;
            }
            else
            {
                if (lastX == char.x && char.animation.curAnim.name != 'idle')
                {
                    char.playAnim('idle');
                }
            }
            lastX = char.x;
            super.update(elapsed);
  • w

    witty-island-52596

    02/22/2023, 2:00 PM
    We dont want all the vode just relevant parts
  • i

    important-egg-61899

    02/22/2023, 2:00 PM
    the problem is that I don't know what part doesn't work
  • i

    important-egg-61899

    02/22/2023, 2:01 PM
    that code is what's inside the update function in my playstate
  • b

    broad-gpu-14081

    02/22/2023, 2:01 PM
    that's why I prefer
    Copy code
    haxe
    if () {
    }
    over
    Copy code
    haxe
    if () 
    {
    }
  • w

    witty-island-52596

    02/22/2023, 2:01 PM
    Try crrating a new project with just the animation code and see what fails
  • i

    important-egg-61899

    02/22/2023, 2:01 PM
    ok
  • w

    witty-island-52596

    02/22/2023, 2:01 PM
    Very unrelated
  • w

    witty-island-52596

    02/22/2023, 2:01 PM
    Its a character limit not a line limit
  • b

    broad-gpu-14081

    02/22/2023, 2:02 PM
    sorry, it was for "I cannot post code because it is long"
  • b

    broad-gpu-14081

    02/22/2023, 2:02 PM
    ah
  • a

    ambitious-knife-25690

    02/22/2023, 2:02 PM
    can you show a gif of the issue?
  • i

    important-egg-61899

    02/22/2023, 2:02 PM
    ok
  • i

    important-egg-61899

    02/22/2023, 2:02 PM
    imma record it rq
  • a

    ambitious-knife-25690

    02/22/2023, 2:02 PM
    might help us tell you which parts are relevant
  • i

    important-egg-61899

    02/22/2023, 2:07 PM
    I think the gif got slowed but I think you might still be able to tell what's going on
  • i

    important-egg-61899

    02/22/2023, 2:07 PM
    oops
  • i

    important-egg-61899

    02/22/2023, 2:07 PM
    that's a slow upload
  • i

    important-egg-61899

    02/22/2023, 2:08 PM
    imma remake that gif
1...946694679468...9809Latest