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.

NPC name over head script

ok, that semi does what i want

Can someone edit it, so that the text is centred over the events head, outlined and doesn't show the players name

here's the script
Code:
#==============================================================================
# ** Event Icon & Text Display
#------------------------------------------------------------------------------
# SephirothSpawn
# Original Text Display By Ã
 
ok, i've managed to get all but the outline and centred done myself

This is the new script
Code:
#==============================================================================
# ** Event Icon & Text Display
#------------------------------------------------------------------------------
# SephirothSpawn
# Original Text Display By Ã
 
If you look at Yeyinde's Font Add-ons, the way he outlined the text was to draw it offset by 1 pixel in each of 8 directions in black,
then draw it at 0,0 in white.  Something like...
Code:
  def create_etd_sprite
    # Creates Display Bitmap
    bitmap = Bitmap.new(192, 26)
    # Draw the outline
    bitmap.font.color.set(0,0,0)    # set color to black
    bitmap.draw_icon_text(-1, -1, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(-1, 0, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(-1, 1, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(0, -1, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(0, 1, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(1, -1, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(1, 0, 192, 24, @character.etd_display_text, 1)
    bitmap.draw_icon_text(1, 1, 192, 24, @character.etd_display_text, 1)
    
    # Draws ETD Display Text
    begin
      bitmap.font.color = @character.etd_display_color
    rescue
      @character.etd_display_color = @character.is_a?(Game_Player) ? 
        Game_Character::ETD_Default_PlayerText_Color : 
        Game_Character::ETD_Default_EventText_Color
      bitmap.font.color = @character.etd_display_color
    end
    bitmap.draw_icon_text(0, 0, 192, 24, @character.etd_display_text, 1)
    # Creates Display Text Sprite
    @_etd_text_sprite = Sprite.new(self.viewport)
    @_etd_text_sprite.bitmap = bitmap
    @_etd_text_sprite.ox = 96
    @_etd_text_sprite.oy = 24
    @_etd_text_sprite.x = self.x
    @_etd_text_sprite.y = self.y - self.oy / 2 - 24
    @_etd_text_sprite.z = 3000
    @_etd_text_sprite.visible = true
    # Saves ETD Text
    @_etd_display_text  = @character.etd_display_text
    @_etd_display_color = @character.etd_display_color
  end

This works. And it's centered over the event.

Be Well
 

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