I've got the Kingdom Hearts HUD Script
Which I have modified slightly for my rpg, but two things i can't seem to work out.
I would like the hud to disappear completely when you press escape to get back to the menu (and then return when you go back to main game), I would also like the players level to appear in the yellow semi circle at the bottom. (screenshot below)
Would somebody be able to help?. It would be greatly appreciated.
heres the script i'm using
heres the screenshot.
http://img6.picsplace.to/img6/25/EternitysEnd_HUD.JPG[/img]
Which I have modified slightly for my rpg, but two things i can't seem to work out.
I would like the hud to disappear completely when you press escape to get back to the menu (and then return when you go back to main game), I would also like the players level to appear in the yellow semi circle at the bottom. (screenshot below)
Would somebody be able to help?. It would be greatly appreciated.
heres the script i'm using
Code:
#==============================================================================
# â– Kingdom Hearts HUD
#------------------------------------------------------------------------------
# by Skive
# skivedaft@yahoo.com
#
# --
#
# released on 5th March 2006
#==============================================================================
#==============================================================================
# â– Sprite_HP
#------------------------------------------------------------------------------
#  the HUD's hp bar
#==============================================================================
class Sprite_HP < Sprite
#--------------------------------------------------------------------------
# â— instances
#--------------------------------------------------------------------------
attr_writer :actor
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor = nil)
super(nil)
self.z = 202
self.bitmap = Bitmap.new(60, 26)
@actor = actor
if !@actor.nil?
@hp = @actor.hp
@maxhp = @actor.maxhp
end
refresh
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
self.bitmap.clear
return if @actor.nil?
@hp = @actor.hp
@maxhp = @actor.maxhp
draw_bar(20, 6)
self.angle = 270
end
#--------------------------------------------------------------------------
# â— update
#--------------------------------------------------------------------------
def update
super
if @actor.nil?
self.bitmap.clear
return
end
if @hp != @actor.hp or @maxhp != @actor.maxhp
refresh
end
end
#--------------------------------------------------------------------------
# â— draw_bar
#--------------------------------------------------------------------------
def draw_bar(radius, width)
max = (@actor.hp * 360) / @actor.maxhp
for j in 1..width
for i in 0..max
bx = Math.cos( (i * Math::PI) / 360) * (radius + j)
by = Math.sin( (i * Math::PI) / 360) * (radius + j)
case j
when 1
color = Color.new(150, 0, 0)
when 2
color = Color.new(170, 0, 0)
when 3
color = Color.new(190, 0, 0)
when 4
color = Color.new(210, 0, 0)
when 5
color = Color.new(230, 0, 0)
when 6
color = Color.new(255, 0, 0)
end
self.bitmap.set_pixel(30 + bx, by, color)
end
end
end
end
#==============================================================================
# â– Sprite_SP
#------------------------------------------------------------------------------
#  the HUD's sp bar
#==============================================================================
class Sprite_SP < Sprite
#--------------------------------------------------------------------------
# â— instances
#--------------------------------------------------------------------------
attr_writer :actor
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(actor = nil)
super(nil)
self.z = 202
self.bitmap = Bitmap.new(60, 26)
@actor = actor
if !@actor.nil?
@sp = @actor.sp
@maxsp = @actor.maxsp
end
refresh
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
self.bitmap.clear
return if @actor.nil?
@sp = @actor.sp
@maxsp = @actor.maxsp
draw_bar(20, 6) #20,6
self.angle = 90
self.mirror = true
end
#--------------------------------------------------------------------------
# â— update
#--------------------------------------------------------------------------
def update
super
if @actor.nil?
self.bitmap.clear
return
end
if @sp != @actor.sp or @maxsp != @actor.maxsp
refresh
end
end
#--------------------------------------------------------------------------
# â— draw_bar
#--------------------------------------------------------------------------
def draw_bar(radius, width)
max = (@actor.sp * 360) / @actor.maxsp
for j in 1..width
for i in 0..max
bx = Math.cos( (i * Math::PI) / 360) * (radius + j)
by = Math.sin( (i * Math::PI) / 360) * (radius + j)
case j
when 1
color = Color.new(29, 82, 112)
when 2
color = Color.new(29, 86, 120)
when 3
color = Color.new(28, 90, 131)
when 4
color = Color.new(27, 96, 144)
when 5
color = Color.new(26, 102, 156)
when 6
color = Color.new(26, 106, 167)
end
self.bitmap.set_pixel(30 + bx, by, color)
end
end
end
end
#==============================================================================
# â– Sprite_HUD
#------------------------------------------------------------------------------
#  draws the HUD on the map
#==============================================================================
class Sprite_HUD < Sprite
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize(corner = 4)
super(nil)
self.z = 200
for actor in $game_party.actors
next if actor.dead?
@actor = actor
@actor_index = $game_party.actors.index(@actor)
break
end
@hp_sprite = Sprite_HP.new(@actor)
@sp_sprite = Sprite_SP.new(@actor)
self.bitmap = Bitmap.new(375, 220)
case corner
when 1
x = 16
y = 16
when 2
x = 640 - 52 - 16
y = 16
when 3
x = 320
y = 20
when 4
x = 170
y = 415
xh = 295
yh= 415
end
self.x = x
self.y = y
@hp_sprite.x = xh + 19 # + 27
@hp_sprite.y = yh + 9 #3
@sp_sprite.x = xh + 32 - 1 #27-1
@sp_sprite.y = yh + 68 #3-1+ 60
refresh
end
#--------------------------------------------------------------------------
# â— refresh
#--------------------------------------------------------------------------
def refresh
self.bitmap.clear
return if @actor.nil?
bitmap = RPG::Cache.picture("background")
self.bitmap.blt(0, 10, bitmap, Rect.new(0, 0, 375, 220))
end
#--------------------------------------------------------------------------
# â— update
#--------------------------------------------------------------------------
def update
super
@hp_sprite.update
@sp_sprite.update
if @actor != $game_party.actors[@actor_index]
@actor = $game_party.actors[@actor_index]
@hp_sprite.actor = @actor
@sp_sprite.actor = @actor
@hp_sprite.refresh
@sp_sprite.refresh
refresh
end
end
end
#==============================================================================
# â– Scene_Map
#------------------------------------------------------------------------------
#  draws the hud on the map screen
# @khhud_corner is the corner you want the hud to be displayed in.
# 1 is upper left, 2 is upper right, 3 is bottom left and 4 is bottom right
#==============================================================================
class Scene_Map
alias main_khhud main
alias update_khhud update
alias transfer_khhud transfer_player
#--------------------------------------------------------------------------
# â— initialize
#--------------------------------------------------------------------------
def initialize
@khhud_corner = 4 # 1 or 2 or 3 or 4
end
#--------------------------------------------------------------------------
# â— main
#--------------------------------------------------------------------------
def main
@hud = Sprite_HUD.new(@khhud_corner)
main_khhud
@hud.dispose
end
#--------------------------------------------------------------------------
# â— update
#--------------------------------------------------------------------------
def update
@hud.update
update_khhud
end
end
heres the screenshot.
http://img6.picsplace.to/img6/25/EternitysEnd_HUD.JPG[/img]