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.

[Resolved] Quick Question: system_color

Status
Not open for further replies.
I want to make system_color some sort of global method or variable so that I can change the color on a lot of text at once. What's the best way to go about this?

Note: Not every line of text I want to color this way has access to Window_Base's system_color or MACL's Sprite_Scrollable's version. I want the ability to make a global variable somewhere that I can call from any class or method as a color and make it really simple to change later on.

Also: After making this global color (using the method you tell me), how would I edit system_color to return it?
 
Code:
class Color
  def self.system_color
    return self.new(r, g, b, a)
  end
end
Untested, but I think it should work. You can make as many as you want, just remember to give them different names and change the RGBA value. To get the colour, use Color.system_color or Color.your_color_name. Hope this helps.
 
Use a Constant, you won't be changing this in game or anything

something like
Code:
System_Color = Color.new(192, 224, 255, 255)

Then to make scripts use that

Code:
class Window_Base
  def system_color
    return System_Color
  end
end

Btw Still making adjustments to MACL so that will change in version 2.0
 
Since Yeyinde posted first I tried that first and it worked, but I'll try the 2nd method as well and see which I like more. With Yeyinde's it looks like I can make a mutator method that can change the color in game, which would be good if I made a Options menu.

Either way, the question was answered. Thanks guys
 
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