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.

How would I change the size of the Damage text.

Its a simple question. If somone could just tell me the script that has the Damage size and the line its in I could change it.

Please and thank you.
 

poccil

Sponsor

It's in the built-in script RPG::Sprite (see the help file).  The size of the damage display can be changed from 32 to a different amount.  A modified version of the method "damage" is below.  Change the _fontsize_ variable below, which is emphasized.

Code:
module RPG
  class Sprite
    def damage(value, critical)
      ####################
      fontsize=50
      criticalfontsize=30
      ####################
      dispose_damage
      if value.is_a?(Numeric)
        damage_string = value.abs.to_s
      else
        damage_string = value.to_s
      end
      dummy=Bitmap.new(1,1)
      dummy.font.name = "Arial Black"
      dummy.font.size = fontsize
      dmgstrsize=dummy.text_size(damage_string)
      dummy.font.size = criticalfontsize
      criticalsize=dummy.text_size("CRITICAL")
      dummy.dispose
      bitmap = Bitmap.new(
         [dmgstrsize.width,criticalsize.width,160].max+8,
         [dmgstrsize.height,criticalsize.height,40].max+8         
      )
      bitmap.font.name = "Arial Black"
      bitmap.font.size = fontsize
      bitmap.font.color.set(0, 0, 0)
      w=dmgstrsize.width
      h=dmgstrsize.height
      bitmap.draw_text(-1, 12-1, bitmap.width,h, damage_string, 1)
      bitmap.draw_text(+1, 12-1, bitmap.width,h, damage_string, 1)
      bitmap.draw_text(-1, 12+1, bitmap.width,h, damage_string, 1)
      bitmap.draw_text(+1, 12+1, bitmap.width,h, damage_string, 1)
      if value.is_a?(Numeric) and value < 0
        bitmap.font.color.set(176, 255, 144)
      else
        bitmap.font.color.set(255, 255, 255)
      end
      bitmap.draw_text(0, 12, bitmap.width,h, damage_string, 1)
      if critical
        w=criticalsize.width
        h=criticalsize.height
        bitmap.font.size = criticalfontsize
        bitmap.font.color.set(0, 0, 0)
        bitmap.draw_text(-1, -1, bitmap.width,h, "CRITICAL", 1)
        bitmap.draw_text(+1, -1, bitmap.width,h, "CRITICAL", 1)
        bitmap.draw_text(-1, +1, bitmap.width,h, "CRITICAL", 1)
        bitmap.draw_text(+1, +1, bitmap.width,h, "CRITICAL", 1)
        bitmap.font.color.set(255, 255, 255)
        bitmap.draw_text(0, 0, bitmap.width,h, "CRITICAL", 1)
      end
      @_damage_sprite = ::Sprite.new(self.viewport)
      @_damage_sprite.bitmap = bitmap
      @_damage_sprite.ox = 80
      @_damage_sprite.oy = 20
      @_damage_sprite.x = self.x
      @_damage_sprite.y = self.y - self.oy / 2
      @_damage_sprite.z = 3000
      @_damage_duration = 40
    end
  end
end

EDIT:  Improved version.
 

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