Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Change position of Gold sign

I asked this ages ago, but i can't find my post...
Nevertheless, i will keep pressing on.

Hi. In window_gold (i guess) what would you have to add/take away for the Gold sign to be before the amount of Gold, i.e. G 6789 instead of 6789 G.
The reason i ask is because i want to use ? as the symbol, and having it after the numbers looks a bit weird.

EDIT
O.K i've figured out how to do that ( i fiddled around with the variables a bit (haven't really got a clue how i did it... like this
Code:
def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = system_color
    self.contents.draw_text(-40, 0, 115-cx-2, 32, $data_system.words.gold, 2)
    self.contents.font.color = normal_color
    self.contents.draw_text(-40, 0, 177-cx-2, 32, $game_party.gold.to_s, 2)
  end
, but the Gold sign stays in the same place the whole time, regardless of what value you have. Is there any way that the Gold could always stay, say 20 or 30 pixels before the first number, regardless of what amount of money you have (whether it is ?1 or ?22303) so, it wouldn't be like this ? 1 or 3232?234234 as in it overtakes the pound sign.



I hope that made sense... lol

cheers
Jonathan
 
Hi, i am not a great scripter but i will try to help.

In window_gold find the line

Code:
self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)

try to change the value 124-cx to somthing like 20-cx
 
Nevermind about my above edit (unless someone can do it!!). Lazarus, your idea worked fine, thanks

You think you're a bad lawyer, did you see what i tried to do... lol

thanks again
 
Code:
class Window_Gold < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 64)
    self.contents = Bitmap.new(width - 32, height - 32)
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    [b]self.contents.draw_text(4, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)[/b]
    self.contents.font.color = system_color
    [b]self.contents.draw_text(124-cx, 0, cx, 32, $data_system.words.gold, 2)[/b]
  end
end
In the above example, I've bolded the lines of interest. These are what draw the text in the window.

Not sure exactly how you want it on the left side, so I present two options
Option 1: Symbol is always left aligned ($_____1000)
Code:
def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    self.contents.font.color = normal_color
    self.contents.draw_text(cx, 0, 120-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, cx, 32, $data_system.words.gold, 2)
  end
Option 2: Symbol is always just to the left of the amount (_____$1000)
Code:
def refresh
    self.contents.clear
    cx = contents.text_size($data_system.words.gold).width
    gx = contents.text_size($game_party.gold.to_s).width
    self.contents.font.color = normal_color
    self.contents.draw_text(cx, 0, 124-cx-2, 32, $game_party.gold.to_s, 2)
    self.contents.font.color = system_color
    self.contents.draw_text(124-cx-gx-[b]2[/b], 0, cx, 32, $data_system.words.gold, 2)
  end
Change the bolded part if you want more space between the symbol and the amount.

[Edit]I'm so slow ^^; That's what I get for testing it first. Well, at least, Option 2 should be of some use to you? you might want to increase the bolded part. Right now, the symbol is only about 2 pixels to the left of the money on hand.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top