jeudi 13 avril 2017

How do i update text graphics in flashpunk?

Here is a class i made that will be used to make the items for a menu i'm working on.

package  
{
    import net.flashpunk.Entity;
    import net.flashpunk.graphics.Graphiclist;
    import net.flashpunk.graphics.Stamp;
    import net.flashpunk.graphics.Text
    import net.flashpunk.FP;
    import net.flashpunk.utils.Input;

    public class MenuItem extends Entity 
    {       
        public var label:Text;  //public text var to display label      
        public var amount:Text;
        public var amountText:String;

        public function MenuItem(x:Number=0, y:Number=0, text:String = "", amnt:Number = 0) 
        {
            super(x, y);

            label = new Text(text, 10, 10, { size: 20, color: 0xFFFFFF, width: 111, wordWrap: false, align: "center" } ); //format text
            label.y = 25; //place text
            label.x = 0; // place text

            amountText = amnt.toString();

            amount = new Text(amountText, 10, 10, { size: 20, color: 0xFFFFFF, width: 111, wordWrap: false, align: "center" } ); 
            amount.y = 25;
            amount.x = 50;
            graphic = new Graphiclist(label, amount);   //set graphic list (png and text)

            setHitbox(110, 70, 0, 0);
        }
         override public function update():void
        {

        }
    }
}

What i'm looking for is how to update the amnt using the update function. But my knowledge of flashpunk is not great and i;m not sure how i would go about doing this exactly. please and thank you! if what i'm asking is unclear please contact me so i can specify whatever is needed.

Aucun commentaire:

Enregistrer un commentaire