Jump to content
SirCumferance

Moving the text over icon

Recommended Posts

I am using the ammo plugin and it has the icon, followed by the amount of ammo. Now, this takes up a lot of space so I shrunk the icon spacing (icon too) but the text is still after it, I need it ON the icon. I already removed the 'x' from the amount but I do not know how to move the text over the icon. Below is the relevant code....I think

 

 for (var ammoId in skill.itemAmmoCost) {
      ammoId = parseInt(ammoId);
      if (!isNaN(ammoId) && (ammoId > 0)) {
         this.changeTextColor(this.textColor(Unco.Param.ammoFontColor));
         //var text = 'x' + String(skill.itemAmmoCost[ammoId]) + ( (Unco.Param.showAmmoLeft === 'false') ? "" : (  "/" + $gameParty.getItemAmount($dataItems[ammoId])  )  );
         var text = String(skill.itemAmmoCost[ammoId]) + ( (Unco.Param.showAmmoLeft === 'false') ? "" : (  "/" + $gameParty.getItemAmount($dataItems[ammoId])  )  );
		 this.contents.fontSize = Unco.Param.ammoFontSize;
         this.drawText(text, wx, wy, dw, 'right');
         dw -= this.textWidth(text);
         this.resetFontSettings();
         if ($dataItems[ammoId].iconIndex > 0) {
            var iw = wx + dw - Window_Base._iconWidth;
            this.drawIcon($dataItems[ammoId].iconIndex, iw, wy + 2);
            dw -= Window_Base._iconWidth - 24;

The plugin is located here.

 

Example: https://www.dropbox.com/s/75dlq9beeavgg0d/Ammo%20Cost.jpg?dl=0

Edited by SirCumferance

Share this post


Link to post
Share on other sites

Try moving the draw text code to be below the draw icon code.

Usually things drawn to the window are placed on top of things that have already been drawn to it. (It's late here, that's my technical explanation :P)

Share this post


Link to post
Share on other sites

Nailed it, thanks for the help.
 

   for (var ammoId in skill.itemAmmoCost) {
      ammoId = parseInt(ammoId);
      if (!isNaN(ammoId) && (ammoId > 0)) {
         this.changeTextColor(this.textColor(Unco.Param.ammoFontColor));
         //JFA//var text = 'x' + String(skill.itemAmmoCost[ammoId]) + ( (Unco.Param.showAmmoLeft === 'false') ? "" : (  "/" + $gameParty.getItemAmount($dataItems[ammoId])  )  );
         var text = String(skill.itemAmmoCost[ammoId]) + ( (Unco.Param.showAmmoLeft === 'false') ? "" : (  "/" + $gameParty.getItemAmount($dataItems[ammoId])  )  );
		 this.contents.fontSize = Unco.Param.ammoFontSize;
         //this.drawText(text, wx, wy, dw, 'right');
         //dw -= this.textWidth(text);
         //this.resetFontSettings();
         if ($dataItems[ammoId].iconIndex > 0) {
            var iw = wx + dw - Window_Base._iconWidth;
            this.drawIcon($dataItems[ammoId].iconIndex, iw, wy + 2);
            dw -= Window_Base._iconWidth - 26;
			this.drawText(text, wx, wy, dw-14, 'right');
            dw -= this.textWidth(text);
            this.resetFontSettings();

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×