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.

Custom HUD

Hey I need/want a HUD like Mario Kart 64 that shows an Icon In the middle and at the top Left hand corner it shows Your Hp and Sp. At the bottom right hand corner needs to be a Speedometer that goes by a Variable. At the bottom left needs to be a Mini-map that shows the whole map..(If there isnt one then just any Mini-Map) I need it to start with the empty box
http://i152.photobucket.com/albums/s171 ... s/star.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/r_shell.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/no_item.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/mushroom.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/lightning.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/g_shell.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/feather.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/coin.jpg[/IMG]http://i152.photobucket.com/albums/s171/Cheezeus/banana_peel.jpg[/IMG]
 
I got this:
http://i78.photobucket.com/albums/j92/chastity_belted/screenieforcheeze.png[/IMG]
(I made the map like that just to show the minimap path)
But I don't get the icon thing. Will it be based on a variable too? And is it like top middle, bottom middle or middle middle?

FYI---I edited the HUD from the d/l folder and used that passability minimap in the submitted scripts forum. So the only thing that's mine is the spedometer :P

:: if you're wondering why I put a screenie instead of a script, it's because I wanted to check if you like it.
Also, there's a minimap to show the whole map but it's not reccomended for large ones like a Mario Kart track. But it doesn't do that whole grey map thing.
 
Yeah I like it but the Item thingy is missing ...Is it because you didnt know how to do it? I could show you how to do it...Cause I'm doing it with a common Event and Variables. Thanks! >> Cheezey Request
 
Okay, I know I said I was busy (PM) and I really am...or should be :P...homework is just so unappealing when everyone else is on march break. Anywho, I somehow lost the project (don't ask lol) so I started over. After fiddling around with the concept of Sprites (hey I'm still newbish!) I managed to get the item icon to appear and stay there...and change lol. Unfortunately, Selwyn has withdrawn the pretty pics for his minimap. Prefix said he'd see if he had them as well as his modification to display the whole map in the minimap. In the mean time, I have this:
Code:
#========================================
# HUD Setup
#--------------------------------------------------------------------------------
SPEDOMETER_VAR = 1 # the variable that controls the spedometer
SPEDOMETER_UNIT = 'mph' # the unit the spedometer measures in
ITEM_VAR = 2 # the variable controling the items.
ITEMS = ['no_item', 'banana_peel', 'coin', 'feather', 'g_shell', 'r_shell', 'lightning', 'mushroom']
# When the variable equals 0, the no_item picture will be displayed.
# The others will be displayed as the variable goes up in their order.
# If the varaible is 1, the picture will be banana_peel.  If it is 2, it will
# be coin; 3 is feather; 4 is g_shell and so on.  Just change the variable
# in your event. Remember, don't make it above one less than the number
# of icons you have.  Make sure you put all your icons in the icon folder.
#========================================
class Scene_Map
  alias hud_main main
  alias hud_update update
  def main
    opacity = 0
    @base = Window_Base.new(0, 0, 640, 480)
    @base.opacity = opacity
    @hud = Hud.new
    @hud.opacity = opacity
    @sped = Spedometer.new
    @sped.opacity = opacity
    @item = Get_Item.new
    hud_main
    @base.dispose
    @hud.dispose
    @sped.dispose
    @item.dispose
  end
  def update
    @base.update
    @hud.update
    @sped.update
    @item.update
    hud_update
  end
end
#--------------------------------------------------------------------------------
# Spedometer
#--------------------------------------------------------------------------------
class Spedometer < Window_Base
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    update
  end
  def update
    self.contents.clear
    var = $game_variables[SPEDOMETER_VAR].to_s
    unit = SPEDOMETER_UNIT.to_s
    uw = contents.text_size(unit).width
    vw = contents.text_size(var).width
    sw = contents.text_size(unit + var).width
    self.contents.font.color = normal_color
    self.contents.draw_text(640-sw-50, 416, vw, 32, var, 0)
    self.contents.font.color = system_color
    self.contents.draw_text(640-uw-45, 416, 200, 32, unit, 0)
  end
end
#--------------------------------------------------------------------------------
#  HUD
#--------------------------------------------------------------------------------
class Hud < Window_Base
  def initialize
    super(0, 0, 800, 600)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
      x = 5
      actor = $game_party.actors[0]
      self.contents.font.size = 21
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 55, -10, 100, 32, actor.name)
      width = 100
      height = 10
      draw_slant_bar(x + 25, 20, actor.hp, actor.maxhp, width, height, Color.new(150, 0, 0), Color.new(155, 155, 60))
      draw_slant_bar(x + 25, 40, actor.sp, actor.maxsp, width, height, Color.new(0, 0, 150), Color.new(60, 155, 155))
      self.contents.font.size = 16
      self.contents.font.color = normal_color
      self.contents.font.bold = true
      self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
      self.contents.draw_text(x + 30, 9, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1)
      self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
      self.contents.draw_text(x + 30, 29, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1)
      self.contents.font.color = system_color
      self.contents.font.size = 20
      self.contents.draw_text(x, 8, 34, 32, $data_system.words.hp)
      self.contents.draw_text(x, 28, 54, 32, $data_system.words.sp)
    end
  end
#--------------------------------------------------------------------------------
# Get item Pop-up
#--------------------------------------------------------------------------------
class Get_Item < Sprite
  def initialize
    super(Viewport.new(0, 0, 640, 480))
    update
  end
  def update
    @pop_up = Sprite.new(super)
    i = $game_variables[ITEM_VAR]
    item = ITEMS[i]
    @pop_up.bitmap = RPG::Cache.icon(item)
    @pop_up.x = 295
    @pop_up.y = 5
  end
end
#--------------------------------------------------------------------------------
# Seph's Bars
#--------------------------------------------------------------------------------
class Window_Base < Window
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
    end
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
  end
end
and I 'fixed' your icons...they were so small...the script might need editing if you REALLY want tiny icons people can't see.
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_star.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_r_shell.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_no_item.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_mushroom.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_lightning.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_g_shell.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_feather.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_coin.png[/IMG]
http://i78.photobucket.com/albums/j92/chastity_belted/cheezey%20hud/th_banana_peel.png[/IMG]
 
ToriVerly;172478 said:
Unfortunately, Selwyn has withdrawn the pretty pics for his minimap. Prefix said he'd see if he had them as well as his modification to display the whole map in the minimap.
yeah so you're waiting on Prefix if he gets back to me....well I have the minimap script, but I'm not sure what each pic is supposed to look like to make it work.
 
Oh...Sorry..Too Hyped up about the script XD

Edit* there is something wroung with the script..It said something about cannot convert nil into string or something.....but it was on line 113

Edit 2* It has to do with the Star...
 
Um are you asking how i did it or how do you make it work? XD

I set ITEM_VAR and ITEMS to the following:
Code:
ITEM_VAR = 2 # the variable controling the items.
ITEMS = ['no_item', 'banana_peel', 'coin', 'feather', 'g_shell', 'r_shell', 'lightning', 'mushroom']
That means that you can control the items with the in game variable 2 (you know in an event). So if you set that variable to:
0 you get the first thing in the ITEMS array (no item)
1 you get a banana peel
2 you get a feather
3 you get a green shell...etc etc in order
 
well its not working..Ive mede a random item thingy with a common event already...So what should i do with that?

EDIT: And...Instead of making the minimap at the bottom left hand corner can you make it the top right hand corner...And make a 1st-8th script thingy at the bottom left hand corner?

Thanks!
 
did you add 'star' to the ITEMS array? apparently i forgot XD
I had:
ITEMS = ['no_item', 'banana_peel', 'coin, feather', 'g_shell', 'r_shell', 'lightning', 'mushroom']
but there's no star in it...so just change it to:
ITEMS = ['no_item', 'banana_peel', 'coin, feather', 'g_shell', 'r_shell', 'lightning', 'mushroom', 'star']

and then set your variable accordingly:

no item is 0
so banana peel is 1
coin is 2
feather is 3
green shell is 4
red shell is 5
lightning is 6
mushroom is 7
star is 8

if you don't like those numbers you can always switch it up with the order in the ITEMS array.
sorry about that :)

EDIT:: and yeah the minimap can go in any corner when Prefix gets it to me.
EDIT:: I can make it show a 1st-8th pic in that corner depending on variables just like the items.
EDIT::Ah I'm getting the error, it happens when the variable is out of range. here:
Code:
#========================================
# HUD Setup
#--------------------------------------------------------------------------------
SPEDOMETER_VAR = 1 # the variable that controls the spedometer
SPEDOMETER_UNIT = 'mph' # the unit the spedometer measures in
ITEM_VAR = 2 # the variable controling the items.
ITEMS = ['no_item', 'banana_peel', 'coin', 'feather', 'g_shell', 'r_shell', 'lightning', 'mushroom', 'star']
# When the variable equals 0, the no_item picture will be displayed.
# The others will be displayed as the variable goes up in their order.
# If the varaible is 1, the picture will be banana_peel.  If it is 2, it will
# be coin; 3 is feather; 4 is g_shell and so on.  Just change the variable
# in your event. Remember, don't make it above one less than the number
# of icons you have.  Make sure you put all your icons in the icon folder.
#========================================
class Scene_Map
  alias hud_main main
  alias hud_update update
  def main
    opacity = 0
    @base = Window_Base.new(0, 0, 640, 480)
    @base.opacity = opacity
    @hud = Hud.new
    @hud.opacity = opacity
    @sped = Spedometer.new
    @sped.opacity = opacity
    @item = Get_Item.new
    hud_main
    @base.dispose
    @hud.dispose
    @sped.dispose
    @item.dispose
  end
  def update
    @base.update
    @hud.update
    @sped.update
    @item.update
    hud_update
  end
end
#--------------------------------------------------------------------------------
# Spedometer
#--------------------------------------------------------------------------------
class Spedometer < Window_Base
  def initialize
    super(0, 0, 640, 480)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    update
  end
  def update
    self.contents.clear
    var = $game_variables[SPEDOMETER_VAR].to_s
    unit = SPEDOMETER_UNIT.to_s
    uw = contents.text_size(unit).width
    vw = contents.text_size(var).width
    sw = contents.text_size(unit + var).width
    self.contents.font.color = normal_color
    self.contents.draw_text(640-sw-50, 416, vw, 32, var, 0)
    self.contents.font.color = system_color
    self.contents.draw_text(640-uw-45, 416, 200, 32, unit, 0)
  end
end
#--------------------------------------------------------------------------------
#  HUD
#--------------------------------------------------------------------------------
class Hud < Window_Base
  def initialize
    super(0, 0, 800, 600)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = 0
    self.contents.font.name = $defaultfonttype
    self.contents.font.size = $defaultfontsize
    refresh
  end
  def refresh
    self.contents.clear
      x = 5
      actor = $game_party.actors[0]
      self.contents.font.size = 21
      self.contents.font.color = normal_color
      self.contents.draw_text(x + 55, -10, 100, 32, actor.name)
      width = 100
      height = 10
      draw_slant_bar(x + 25, 20, actor.hp, actor.maxhp, width, height, Color.new(150, 0, 0), Color.new(155, 155, 60))
      draw_slant_bar(x + 25, 40, actor.sp, actor.maxsp, width, height, Color.new(0, 0, 150), Color.new(60, 155, 155))
      self.contents.font.size = 16
      self.contents.font.color = normal_color
      self.contents.font.bold = true
      self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? crisis_color : normal_color
      self.contents.draw_text(x + 30, 9, 100, 32, "#{actor.hp}/#{actor.maxhp}", 1)
      self.contents.font.color = actor.sp == 0 ? crisis_color : actor.sp <= actor.maxsp / 4 ? crisis_color : normal_color
      self.contents.draw_text(x + 30, 29, 100, 32, "#{actor.sp}/#{actor.maxsp}", 1)
      self.contents.font.color = system_color
      self.contents.font.size = 20
      self.contents.draw_text(x, 8, 34, 32, $data_system.words.hp)
      self.contents.draw_text(x, 28, 54, 32, $data_system.words.sp)
    end
  end
#--------------------------------------------------------------------------------
# Get item Pop-up
#--------------------------------------------------------------------------------
class Get_Item < Sprite
  def initialize
    super(Viewport.new(0, 0, 640, 480))
    update
  end
  def update
    @pop_up = Sprite.new(super)
    i = $game_variables[ITEM_VAR]
    item = ITEMS[i]
    @pop_up.bitmap = RPG::Cache.icon(item) if item != nil
    @pop_up.x = 295
    @pop_up.y = 5
  end
end
#--------------------------------------------------------------------------------
# Seph's Bars
#--------------------------------------------------------------------------------
class Window_Base < Window
  def draw_slant_bar(x, y, min, max, width = 152, height = 6,
      bar_color = Color.new(150, 0, 0, 255), end_color = Color.new(255, 255, 60, 255))
    for i in 0..height
      self.contents.fill_rect(x + i, y + height - i, width + 1, 1, Color.new(50, 50, 50, 255))
    end
    for i in 1..(height - 1)
      r = 100 * (height - i) / height + 0 * i / height
      g = 100 * (height - i) / height + 0 * i / height
      b = 100 * (height - i) / height + 0 * i / height
      a = 255 * (height - i) / height + 255 * i / height
      self.contents.fill_rect(x + i, y + height - i, width, 1, Color.new(r, b, g, a))
    end
    for i in 1..( (min / max.to_f) * width - 1)
      for j in 1..(height - 1)
        r = bar_color.red * (width - i) / width + end_color.red * i / width
        g = bar_color.green * (width - i) / width + end_color.green * i / width
        b = bar_color.blue * (width - i) / width + end_color.blue * i / width
        a = bar_color.alpha * (width - i) / width + end_color.alpha * i / width
        self.contents.fill_rect(x + i + j, y + height - j, 1, 1, Color.new(r, g, b, a))
      end
    end
  end
end
 

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