Closed moxie-coder closed 1 month ago
didn't mean to close this, lmk if you're still having troubles. Also, how are you customizing these by extension, if not with loadGraphic?
didn't mean to close this, lmk if you're still having troubles. Also, how are you customizing these by extension, if not with loadGraphic?
okay firstly, my bad since I forgot Paths.image
which means I didn't really have to extend it, but another issue arises when trying to replace it
here's an snippet of the code I'm using too
button = new FlxButton(0, 0, buttonName, function(){
switch(buttonName){
case 'Story mode':
MusicBeatState.switchState(new StoryMenuState());
case 'Freeplay':
MusicBeatState.switchState(new FreeplayState());
case 'Credits':
MusicBeatState.switchState(new CreditsState());
case 'Options':
LoadingState.loadAndSwitchState(new options.OptionsState());
default: null;
}
});
button.loadGraphic(Paths.image('mcButton/button_medium'), true, 200, 20);
button.animation.add('idle', [0], 24, false);
button.animation.add('hover', [2, 1], 24, false);
button.animation.play('idle', false);
button.label.setFormat(Paths.font('minecraftia.ttf'), 8, FlxColor.YELLOW, "center");
button.y += 150 + i * 100;
button.screenCenter(X);
add(button);
should we move this into a discussion?
There is no way to customize the graphics of the button without extending the class due to having no functions for customization, so extending the class is really the only way to get around the default graphics. I was hoping that it would be possible to customize it without even having to extend the class.