Beginner questions

It’s almost right, you just need to use the setter method on the builder instead of creating a new EffectBuilder inside it (that won’t be used). Also, for hover effects you should use a HoverEffectBuilder. Oh and the parameter you pass to the EffectBuilder/HoverEffectBuilder is the effect name (like move, textSize etc.).

Something like this:

[java]text(new TextBuilder() {{

text(“Singleplayer”);

font(“Interface/Fonts/Default.fnt”);

height(“80px”);

width(“200px”);

onHoverEffect(new HoverEffectBuilder(“textSize”) {{

length(1000);

startDelay(0);

inherit(true);

post(false);

hoverFalloffType(Falloff.HoverFalloffType.linear);

hoverFalloffConstraint(Falloff.HoverFalloffConstraint.both);

hoverWidth(“200%”);

hoverHeight(“200%”);

}});

interactOnClick(“Singleplayerclick()”);

}});[/java]

Note that the above code might not be 100% correct, as I just typed it here with help of the javadoc: Nifty Core 1.3.1 API.

2 Likes