ShadowMario / FNF-PsychEngine

Engine originally used on Mind Games mod
Apache License 2.0
1.11k stars 2.18k forks source link

No transition on my custom state #10850

Closed flaaws closed 1 year ago

flaaws commented 1 year ago

Describe your problem here.

heyo! made a new state for my mod, and it works and everything, but it doesnt have a smooth transition upon opening it.

see video.

https://user-images.githubusercontent.com/88951878/195874804-badb4772-0b67-4928-8022-d4953a413b4c.mp4

see how it just snaps to the next state rather than fading to it? how would I fix that?

Are you modding a build from source or with Lua?

Source

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

Made a new state.

Stilic commented 1 year ago

Check if the state you did is extending MusicBeatState.

flaaws commented 1 year ago

Check if the state you did is extending MusicBeatState.

image

yep

flaaws commented 1 year ago

bumping, not sure if this helps or not

REALHaydenGaming commented 1 year ago

Are you using LoadingState.loadAndSwitchState(new MainMenuState()); ? Did you fuck up the CustomFadeTransition?

flaaws commented 1 year ago

Are you using LoadingState.loadAndSwitchState(new MainMenuState()); ? Did you fuck up the CustomFadeTransition?

I wasnt, but when i did it still didn't fix my issue. I didn't touch anything related to that state, every other state has a transition other than the ones ive made

REALHaydenGaming commented 1 year ago

Then USE the MusicBeatSubstate. I don't have your "source code" for this.

flaaws commented 1 year ago

Then USE the MusicBeatSubstate. I don't have your "source code" for this.

wdym use the music beat substate???? sorry if i seem dumb but i have no idea how to do that.

heres the code for switching states

` if(FlxG.mouse.overlaps(collectionmenu)){ if(FlxG.mouse.justPressed){ FlxTween.tween(FlxG.camera, {zoom: 1.025}, 1, {ease: FlxEase.expoOut});

            FlxG.sound.play(Paths.sound('confirmMenu'));
            LoadingState.loadAndSwitchState(new CollectionsState());
        }
    }`

and heres the actual code for the state it goes to.

`package;

if desktop

import Discord.DiscordClient;

end

import flash.text.TextField; import flixel.FlxG; import flixel.FlxSprite; import flixel.addons.display.FlxGridOverlay; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.math.FlxMath; import flixel.text.FlxText; import flixel.util.FlxColor; import flixel.addons.transition.FlxTransitionableState; import flixel.tweens.FlxTween; import flixel.tweens.FlxEase; import flixel.input.mouse.FlxMouseEventManager;

if MODS_ALLOWED

import sys.FileSystem; import sys.io.File;

end

import lime.utils.Assets;

using StringTools;

class CollectionsState extends MusicBeatState { var bg = new FlxSprite().loadGraphic(Paths.image('creditsMenu/bgGradient')); var textcollect = new FlxSprite().loadGraphic(Paths.image('collectionsMenu/collectionText')); var button1 = new FlxSprite(320, FlxG.height 0.1).loadGraphic(Paths.image('collectionsMenu/remixesButton')); var button2 = new FlxSprite(550, FlxG.height 0.1).loadGraphic(Paths.image('collectionsMenu/coversButton')); var button3 = new FlxSprite(775, FlxG.height * 0.1).loadGraphic(Paths.image('collectionsMenu/challengeButtonGreyedOut'));

var curSelected:Int = -1;

var offsetThing:Float = -75;

override public function create():Void
{
    #if desktop
    DiscordClient.changePresence("in da collections", null);
    #end

    transIn = FlxTransitionableState.defaultTransIn;
    transOut = FlxTransitionableState.defaultTransOut;

    FlxG.mouse.visible = true;
    FlxG.sound.music.fadeIn(0.3, 0, 0.2);

}

override public function update(elapsed:Float):Void
{
    persistentUpdate = false;

    add(bg);
    bg.screenCenter();

    add(textcollect);
    textcollect.screenCenter();

    add(button1);
    button1.alpha = 0.4;

    add(button2);
    button2.alpha = 0.4;

    add(button3);
    button3.alpha = 0.4;

    //button one
    if(FlxG.mouse.overlaps(button1)){
        button1.alpha = 1;
    }
    else
    {
        button1.alpha = 0.5;
    }

    //button two
    if(FlxG.mouse.overlaps(button2)){
        button2.alpha = 1;
    }
    else
    {
        button2.alpha = 0.5;
    }

    //button 3
    if(FlxG.mouse.overlaps(button3)){
        button3.alpha = 1;
    }
    else
    {
        button3.alpha = 0.5;
    }

    //remixes
    if(FlxG.mouse.overlaps(button1)){
        if(FlxG.mouse.justPressed){
            FlxTween.tween(FlxG.camera, {zoom: 1.025}, 1, {ease: FlxEase.expoOut});

            FlxG.sound.play(Paths.sound('confirmMenu'));
            LoadingState.loadAndSwitchState(new RemixesState());
        }
    }

    //covers
    if(FlxG.mouse.overlaps(button2)){
        if(FlxG.mouse.justPressed){
            FlxTween.tween(FlxG.camera, {zoom: 1.025}, 1, {ease: FlxEase.expoOut});

            FlxG.sound.play(Paths.sound('confirmMenu'));
            LoadingState.loadAndSwitchState(new CoversStates());
        }
    }

    //challenge songs
    if(FlxG.mouse.overlaps(button3)){
        if(FlxG.mouse.justPressed){
            FlxG.sound.play(Paths.sound('errorMenu'));
            FlxG.camera.shake(0.005,0.25,null,true,X);
        }
    }

    if (FlxG.sound.music.volume < 0.7)
    {
        FlxG.sound.music.volume += 0.5 * FlxG.elapsed;
    }

    if (controls.BACK)
        {
            FlxG.sound.play(Paths.sound('cancelMenu'));
            MusicBeatState.switchState(new MainMenuState());
        }
}

}`

REALHaydenGaming commented 1 year ago

Yeah I can kinda see your "issue"; MainMenuState isn't a MusicBeatState Extender.