Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Mouse in Main Menu #11903

Description

@auroralash

Describe your problem here.

Currently adding mouse functionality to MainMenuState and I get an error when doing a lime test.

Code i have nested inside of override function update(elapsed:Float):

function mousePressedCallback(sprite:FlxSprite) 
{
	if (FlxG.mouse.justPressed)
	{
		menuItems.forEach(function(spr:FlxSprite) 
                {
			FlxFlicker.flicker(spr, 1, 0.06, false, false, function(flick:FlxFlicker)
			{
				var daChoice:String = optionShit[curSelected];
	
				switch (daChoice)
				{
					case 'story_mode':
						MusicBeatState.switchState(new StoryMenuState());
					case 'freeplay':
						MusicBeatState.switchState(new FreeplayState());
					case 'awards':
						MusicBeatState.switchState(new AchievementsMenuState());
					case 'credits':
						MusicBeatState.switchState(new CreditsState());
					case 'options':
						LoadingState.loadAndSwitchState(new options.OptionsState());
				}
			});
		});
	}
}
	
function mouseReleasedCallback(sprite:FlxSprite) {}

FlxMouseEventManager.add(menuItem, mousePressedCallback, mouseReleasedCallback, null, null, false, true, false, [FlxMouseButtonID.LEFT]);

I reused some of the code for controls.ACCEPT so that could be the problem, but i'm not 100% sure.

I also get this error when doing a test build:

flixel/input/mouse/FlxMouseEventManager.hx (line 481)
flixel/FlxGame.hx (line 745)
flixel/FlxGame.hx (line 677)
flixel/FlxGame.hx (line 545)
openfl/events/EventDispatcher.hx (line 402)
openfl/display/DisplayObject.hx (line 1399)

Uncaught Error: Null Object Reference
Please report this error to the GitHub page: https://github.com/ShadowMario/FNF-PsychEngine

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.

Currently adding mouse functionality in the main menu.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions