Skip to content

Instantly share code, notes, and snippets.

@TakkunMaker
Created February 7, 2018 12:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TakkunMaker/cfc106ca9998a3c75eeb272cb3977589 to your computer and use it in GitHub Desktop.
Save TakkunMaker/cfc106ca9998a3c75eeb272cb3977589 to your computer and use it in GitHub Desktop.
#==============================================================================
# ** TK - TK - Status Gauges
#------------------------------------------------------------------------------
# Autor: Takkun (a.k.a Faalco)
# Create: 07/02/2018
# Version: 1.0a
#==============================================================================
# * Instructions & Info:
# -----------------------------------------------------------------------------
# Paste the script above the main of your project, and make the necessary
# settings.
#
# This script (Only the TK - Status Gauges) can be used for commercial and
# non-commercial purposes, credits are welcome but not required.
#
# Any problems before the script can be taken on the topics of the same or by
# personal message us forums in which I participate.
#
#==============================================================================
($imported ||= {})["TK - Status Gauges"] = true
#==============================================================================
# ** Colors
#------------------------------------------------------------------------------
# The RGBA color Module.
#==============================================================================
module Colors
#--------------------------------------------------------------------------
# * Color1 (Darker)
#--------------------------------------------------------------------------
Color1 = [
Color.new(255, 140, 0), #MHP
Color.new(65, 105, 225), #MMP
Color.new(220,20,60), #ATK
Color.new(34, 139, 34), #DEF
Color.new(255, 20, 147), #MAT
Color.new(153, 50, 204) #MDF
]
#--------------------------------------------------------------------------
# * Color2 (Light)
#--------------------------------------------------------------------------
Color2 = [
Color.new(255, 165, 0), #MHP
Color.new(135, 206, 250), #MMP
Color.new(255, 0, 0), #ATK
Color.new(144, 238, 144), #DEF
Color.new(255, 182, 193), #MAT
Color.new(218, 112, 214) #MDF
]
end
#==============================================================================
# ** Game_BattlerBase
#------------------------------------------------------------------------------
# This base class handles battlers. It mainly contains methods for calculating
# parameters. It is used as a super class of the Game_Battler class.
#==============================================================================
class Game_BattlerBase
#--------------------------------------------------------------------------
# * Get Maximum Value of Parameter
#--------------------------------------------------------------------------
def param_max(param_id)
return 999999 if param_id == 0 # MHP
return 9999 if param_id == 1 # MMP
return 500
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This is a super class of all windows within the game.
#==============================================================================
class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Gauge
# rate : Rate (full at 1.0)
# color1 : Left side gradation
# color2 : Right side gradation
#--------------------------------------------------------------------------
def draw_gauge(x, y, width, rate, color1, color2)
fill_w = (width * rate).to_i
gauge_y = y + line_height - 8
contents.fill_rect(x - 2, gauge_y - 2, width + 4, 10, Color.new(0, 0, 0))
contents.fill_rect(x - 1, gauge_y - 1, width + 2, 8, Color.new(255, 255, 255))
contents.fill_rect(x, gauge_y, width, 6, gauge_back_color)
contents.gradient_fill_rect(x, gauge_y, fill_w, 6, color1, color2)
end
end
#==============================================================================
# ** Window_Status
#------------------------------------------------------------------------------
# This window displays full status specs on the status screen.
#==============================================================================
class Window_Status < Window_Selectable
#--------------------------------------------------------------------------
# * Draw Parameters
#--------------------------------------------------------------------------
def draw_parameters(x, y)
6.times { |i|
draw_gauge(
x,
y + line_height * i,
164,
@actor.param(i).to_f / @actor.param_max(i).to_f,
Colors::Color1[i],
Colors::Color2[i]
)
change_color(system_color)
draw_text(x, y + line_height * i, 50, line_height, Vocab::param(i))
draw_current_and_max_values(x, y + line_height * i, 164, @actor.param(i), @actor.param_max(i),
hp_color(@actor), normal_color)
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment