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.

changing text colour in battles

Status
Not open for further replies.
I'm trying to change the colour of the actors name in battle to black, i've found the code that seems to display it in Window_BattleStatus but dont know how to edit it to work

Code:
  def refresh
    self.contents.clear
    @item_max = $game_party.actors.size
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      actor_x = i * 160 + 4
      draw_actor_name(actor, actor_x, 0)
      draw_actor_hp(actor, actor_x, 32, 120)
      draw_actor_sp(actor, actor_x, 64, 120)
      if @level_up_flags[i]
        self.contents.font.color = normal_color
        self.contents.draw_text(actor_x, 96, 120, 32, "LEVEL UP!")
      else
        draw_actor_state(actor, actor_x, 96)
      end
    end
  end

i only want the actors name as the rest is fine
 
Below self.contents.clear, add

self.contents.font.color = text_color(n)

or

self.contents.font.color = Color.new(r, g, b, a)

The first one uses colors you can use in the message windows and such. The second allows you to create your own custom color with rgb values. Just replace rgb with something like 225, 225, 225. You can do 255, but I personally think a slight gray looks better than a complete solid black. The last value is just the alpha or opaicty value. You can just use 255 to make it completely clear (recommended).
 
First find this in Window_Base:
Code:
  def draw_actor_name(actor, x, y)
    self.contents.font.color = normal_color
    self.contents.draw_text(x, y, 120, 32, actor.name)
  end

Change it to

Code:
  def draw_actor_name(actor, x, y)
    self.contents.font.color = Color.new(0, 0, 0, 255)
    self.contents.draw_text(x, y, 120, 32, actor.name)
  end

for solid black :)

Window_Base has other methods you might want check, for example to change the HP color look for draw_actor_hp, etc. Changing font color is indeed done by changing self.contents.font.color, but these methods were written to simplify the process.
 

ccoa

Member

Everywhere.

Replace this line:

draw_actor_name(actor, actor_x, 0)

With:

self.contents.font.color = Color.new(255, 255, 255, 255)
self.contents.draw_text(actor_x, 0, 120, 32, actor.name)
 
You can report it whenever it is resolved. :)

This topic has been resolved. If Desbrina or any other users have any questions or further problems regarding this topic, please create a new thread about them.

Thank you!
 
Status
Not open for further replies.

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