Do you really have to create a new entity class for every time you want to have different text in the same world.
Text Entities Worlds an classes
I don’t know how you’re going about it, but I would do this:
new Entity(0, 0, new Text("First text!", ...);
new Entity(0, 100, new Text("Second text!", ...);
new Entity(100, 0, new Text("Another text!", ...);
Since Text is just a graphic class, you can assign it to any entity you want.
Yeah, this is basically just a shortcut for that. The Entity constructor can take an optional graphic and mask so you can do this sort of thing without having to have a ton of different classes for each small difference you might want.
You could assign a Graphiclist to an Entity and place multiple Text graphics inside that. Other than that, yes, I’m pretty sure you have to create a new Entity for separate Text graphics.
You could also use the World’s addGraphic function:
FP.world.addGraphic(new Text("Hello", 100, 100));
This will create a new Entity for the Text automatically. It also returns said Entity so you can use it to define any variables, should you need to access the Entity in the future. However, I don’t believe you would be able to edit the Text once it was created. Keep in mind, addGraphic will not utilize FlashPunk’s object pooling system and you will be making brand new Entities each time you call it, unfortunately.
And finally, you can just simply do what jacobalbano suggested and make new Entities yourself for each Text graphic. Preferably your own Entity class so you could edit the Text after it was created.