How to show text above a moving actor
Conditions:-
1. Without making another class to show text
2. The text should move above the actor
getWorld().showText(name, getX(), getY()-45);
getWorld().showText(null, getX(), getY()-45);
getWorld().showText(name, getX(), getY()-45);
getWorld().showText(null, getX(), getY()-45);
protected void addedToWorld(World world)
{
world.showText(name, getX(), getY()-45);
}//constructor
protected void addedToWorld(World world)
{
world.showText(name, getX(), getY()-45);
}
public void act
{
getWorld().showText(null, getX(), getY()-45);
//Rest of the code
}