Editing HP Draw method

Hero_Claive

(Phoenix Ember)
Veteran
Joined
Jan 5, 2016
Messages
149
Reaction score
88
First Language
English
Primarily Uses
RMVXA
Hey y'all,

I need help editing a very cryptic method which draws an HP number using a custom sprite image instead of using the default text. Here is the method:

Code:
  def refresh_hp
      @hp_number.bitmap.clear
      number = @actor.hp.abs.to_s.split(//)
      number_cw = @number_image_1_cw
      number_ch = @number_image_1_ch
      for i in 0..number.size - 1
          number_abs = number[i].to_i
          nsrc_rect = Rect.new(number_cw * number_abs, 0, number_cw , number_ch)
          @hp_number.bitmap.blt(number_cw  *  i, 0, @number_image_1, nsrc_rect)       
      end
  end
The problem is that no matter how I edit the image, the HP ends up looking like this:
Obviously it looks really awkward with the spacing of the numbers and this can't be fixed since in the sprite image, each number has a different width (for example, the number 1 has lots of room in its cell as opposed to 5 which requires a bigger cell). So I'm asking how to edit this code to reduce the space between numbers by 1 pixel. That should most definitely fix the problem, but this method is so foreign to me I have absolutely no idea how to go about making that fix. If anyone could help out and teach me how to edit this, that would be wonderful.

Thanks in advance!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,074
Members
137,578
Latest member
JamesLightning
Top