Text Offset Problem


(Marouf Arnaout) #1

I am having a problem with the Text class. It seems as though that the Text has a default offset from it’s x and y. For the default size, this is usually one pixel to the right and 4 pixels downwards, although this value increases as the size increases. I understand that this behavior is normal and favorable in a lot of situations, but I would prefer to get rid of it and yet cannot figure out how to do so. I’ve searched for an answer to this question but can’t find one. I’ve added my code below in case I did something wrong.

package
{ import net.flashpunk.Entity; import net.flashpunk.FP; import net.flashpunk.graphics.Text; import net.flashpunk.World;

public class Game extends World 
{
	
	public var word: Text
	
	public var wordEntity: Entity;
	
	public function Game() 
	{
		FP.screen.color = 0x000000;
		word = new Text("FIGHT", 0, 0) 
		wordEntity = new Entity(0, 0, word);
	        add(wordEntity);
            }

(der_r) #2

Just use a negative value for the x/y properties of the graphic. They get used as an offset for rendering.