Hi!
Im making a speech bubble for my people so that cops can shout at robbers and engage in battle
Anyway, heres a screenshot of the 3 diffrent senarios that happens with the speechbubble:
And heres the code:
[java]public class ChatBubble {
public ChatBubble(Node piv, String msg, boolean shout) {
BillboardControl bc = new BillboardControl();
bc.setAlignment(BillboardControl.Alignment.Screen);
String bubbleImage = âSpeechBubble.pngâ;
if (shout) {
bubbleImage = âShoutBubble.pngâ;
}
Picture bubble = new Picture("");
bubble.setImage(MainClass.getAsset(), bubbleImage, true);
bubble.scale(2);
bubble.setIgnoreTransform(false);
bubble.setQueueBucket( Bucket.Transparent );
bubble.setPosition(-1, 0);
bubble.addControl(bc);
bubble.setLocalTranslation(0,2,0);
piv.attachChild(bubble);
BitmapFont fnt = MainClass.getAsset().loadFont(âInterface/Fonts/Default.fntâ);
BitmapText label = new BitmapText(fnt, false );
label.setSize( .3f );
label.setText(msg);
float textWidth = label.getLineWidth();
float textOffset = textWidth / 2;
label.setBox( new Rectangle(-textOffset,0, textWidth, label.getHeight()) );
label.setColor(ColorRGBA.Black);
label.setAlignment( BitmapFont.Align.Left);
label.setQueueBucket( Bucket.Transparent );
BillboardControl bc2 = new BillboardControl();
bc2.setAlignment(BillboardControl.Alignment.Screen);
label.addControl(bc2);
label.setLocalTranslation(0,4,0);
piv.attachChild(label);
}
}[/java]
Create a new instance of it will do the bubble.
But as you can see, they overlap diffrently depending on the angle your watching it from.
How can I manually adjust which to be renderd first?