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.

DeM0nFiRe's HUD_01

DeM0nFiRe's HUD_01
Current Version: V1.0 (08/01/07)


Introduction

Recently I've decided that I really like to make HUDs. If you gusy like this one, I'll keep making more. Hopefully this will be only the first of many HUDs I make. Basically, this script does three things: Displays a mini-map, displays health, and displays location name. Now, my favorite part of this script is the mini-map. It is similar to the GTA mini-map, but with a few features I've added to make it better. For instance, there are three possible backgrounds built into the script: Black(default), Water, and Sky. Read the instructions to learn how to use all the features the script has.

Features

- Health Display
> Health Bar
> Health Numerals
- Location(map) Name Display
- Mini-Map
> Works perfectly with any map size, big or small.
> Three backgrounds built in: Black(default), Water and Sky.
> Centers on player's close proximity.

Screenshots

http://i12.tinypic.com/61k26px.jpg[/IMG]
http://i12.tinypic.com/4yanpzk.jpg[/IMG]
http://i19.tinypic.com/4p00ac0.jpg[/IMG]

Demo

Demo


Script


Code:
################################################################################
# - Title: DeM0nFiRe's HUD_01 #
# - Current Version: V1.0 (08/01/07) #
# - Scripted by: DeM0nFiRe #
#=======Make sure you read everything from this double line to the next========#
# - Requirements: To use this script you need the following pictures: #
# >"HUD_01_Frame" (144x144) #
# >"HUD_01_water" (128x128) #
# >"HUD_01_sky" (128x128) #
# >"HUD_01_player_icon" (8x8) #
# (These can be found where this script was found) #
# In addition, you must have the picture you want displayed as #
# the mini-map for each map in the project. The dimensions of #
# this map should be 1/4 the pixel dimensions of the actual #
# map, or: (8*number of tiles X)x(8*number of tiles Y) #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# - Installation: 1.)Insert this into an empty slot above Main and below the #
# rest of the default scripts in the script editor. #
# 2.)Go to Scene_Map and insert the following: #
# >"$HUD = HUD_01.new" at line 14 #
# >"$HUD.dispose" at line 39 #
# >"$HUD.update" at line 61 #
# >"$HUD.dispose" at line 276 #
# >"$HUD = HUD_01.new" at line 277 #
# 3.)Put the map ID numbers for any maps that you would like #
# to use the water or sky backgrounds in the corresponding #
# array which you can find by pressing Ctrl+F and entering #
# //CUSTOMIZE in the text-box #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# - Terms of Use: In order to use this script you MUST agree to ALL of the #
# following: #
# >You will credit DeM0nFiRe in any and all projects you #
# you use this script in, or any pictures made to go #
# this script #
# >The pictures named in the requirements are for this #
# ONLY, and may NOT be used for any other purpose #
# >This script will be used ONLY for non-commercial(free)#
# projects. If you would like to use this script in a #
# project for money, contact DeM0nFiRe. #
#===Thank you for using DeM0nFiRe's HUD_01=====================================#
################################################################################
#==============================================================================#
# - Begin HUD_01 Class #
#==============================================================================#
class HUD_01
#==============================================================================#
# - Initialize HUD_01 #
#==============================================================================#
def initialize
#---Define which maps will use water ans sky bacgrounds for mini-map------------
# //CUSTOMIZE
@water_back = [] # Any number in this array will have it's corresponding
# map's mini-map have water for a backgound.
 
@sky_back = [] # Any number in this array will have it's corresponding
# map's mini-map have sky for a backgound.
#---Draws frame for mini-map---------------------------------------------------- 
@frame = Sprite.new
@frame.bitmap = RPG::Cache.picture("HUD_01_Frame")
@frame.x = 640-144
@frame.y = 480-144
#---Sets up to draw player's location name--------------------------------------
@location_name = Sprite.new
@location_name.bitmap = Bitmap.new(200,32)
@location_name.x = (640/2)-100
@location_name.y = 480-32
@location_name.bitmap.font.name = "Trebuchet MS"
#---Sets up to draw health bar and health numbers------------------------------- 
@health = Sprite.new
@health.bitmap = Bitmap.new(100,32)
@health.x = 640 - 128
@health.y = 480 - 161
#---Sets up viewport for minimap------------------------------------------------ 
@map_viewport = Viewport.new(640-136,480-136,128,128)
#---Draws mini-map--------------------------------------------------------------
@map = Sprite.new(@map_viewport)
@map.bitmap = RPG::Cache.picture("HUD_01_map" + $game_map.map_id.to_s)
@map.z = 9998
@map.zoom_x = 0.5
@map.zoom_y = 0.5
#---Draws player icon on mini-map-----------------------------------------------
@player_icon = Sprite.new(@map_viewport)
@player_icon.bitmap = RPG::Cache.picture("HUD_01_player_icon")
@player_icon.x = 64
@player_icon.y = 64
@player_icon.z = 9999
#---Sets up to draw mini-map bacground------------------------------------------ 
@map_back = Sprite.new(@map_viewport)
@map_back.z = 9996
#---Draws mini map background---------------------------------------------------
if @water_back.include?($game_map.map_id)
@map_back.bitmap = RPG::Cache.picture("HUD_01_water")
else
if @sky_back.include?($game_map.map_id)
@map_back.bitmap = RPG::Cache.picture("HUD_01_sky")
else
@map_back.bitmap = Bitmap.new(128,128)
@map_back.bitmap.fill_rect(0,0,128,128,Color.new(0,0,0))
end
end
#---Updates HUD_01-------------------------------------------------------------- 
update
#-Ends initialization-----------------------------------------------------------
end
#==============================================================================#
# - Update HUD_01 #
#==============================================================================#
def update
#---Draws location name---------------------------------------------------------
if @map_id != $game_map.map_id
@map_id = $game_map.map_id
@location_name.bitmap.clear
@location_name.bitmap.draw_text(0, 0, 200, 32, $data_mapinfo[$game_map.map_id].name,1)
end
#---Draws health bar and health numbers----------------------------------------- 
if @player_health != $game_party.actors[0].hp/$game_party.actors[0].maxhp
@health.bitmap.clear
@health.bitmap.fill_rect(0,0, ($game_party.actors[0].hp/$game_party.actors[0].maxhp * 100),16,Color.new(255,0,0))
@health.bitmap.fill_rect(0,15, ($game_party.actors[0].hp/$game_party.actors[0].maxhp * 100),1,Color.new(140,0,0))
@health.bitmap.fill_rect(0,14, ($game_party.actors[0].hp/$game_party.actors[0].maxhp * 100),1,Color.new(160,0,0))
@health.bitmap.fill_rect(0,13, ($game_party.actors[0].hp/$game_party.actors[0].maxhp * 100),1,Color.new(190,0,0))
@health.bitmap.fill_rect(0,12, ($game_party.actors[0].hp/$game_party.actors[0].maxhp * 100),1,Color.new(235,0,0))
@health.bitmap.fill_rect(0,0, ($game_party.actors[0].hp/$game_party.actors[0].maxhp * 100),1,Color.new(255,100,100))
@health.bitmap.font.name = "Trebuchet MS"
@health.bitmap.draw_text(0, -4, 100 , 16, "HP:_" + $game_party.actors[0].hp.to_s+"/ "+$game_party.actors[0].maxhp.to_s)
end
#---Moves mini-map based on player's X and Y------------------------------------ 
if @map.x*32 != $game_player.x or @map.y*32 != $game_player.y
@map.x = 64 - ($game_player.x * 4)
@map.y = 64 - ($game_player.y * 4)
end
#-Ends Update-------------------------------------------------------------------
end
#==============================================================================#
# - Dispose HUD_01 #
#==============================================================================#
def dispose
#---Disposes all sprites--------------------------------------------------------
@location_name.dispose
@health.dispose
@map_viewport.dispose
@map.dispose
@player_icon.dispose
#-Ends disposing----------------------------------------------------------------
end
#Ends HUD_01 class--------------------------------------------------------------
end
#==============================================================================#
# - End of HUD_01 Class #
#==============================================================================#


Instructions:

Code:
# - Requirements: To use this script you need the following pictures:          #
#                     >"HUD_01_Frame"       (144x144)                          #
#                     >"HUD_01_water"       (128x128)                          #
#                     >"HUD_01_sky"         (128x128)                          #
#                     >"HUD_01_player_icon" (8x8)                              #
#                     (These can be found where this script was found)         #
#                 In addition, you must have the picture you want displayed as #
#                 the mini-map for each map in the project. The dimensions of  #
#                 this map should be 1/4 the pixel dimensions of the actual    #
#                 map, or: (8*number of tiles X)x(8*number of tiles Y)         #
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# - Installation: 1.)Insert this into an empty slot above Main and below the   #
#                    rest of the default scripts in the script editor.         #
#                 2.)Go to Scene_Map and insert the following:                 #
#                       >"$HUD = HUD_01.new" at line 14                        #
#                       >"$HUD.dispose" at line 39                             #
#                       >"$HUD.update" at line 61                              #
#                       >"$HUD.dispose" at line 276                            #
#                       >"$HUD = HUD_01.new" at line 277                       #
#                  3.)Put the map ID numbers for any maps that you would like  #
#                     to use the water or sky backgrounds in the corresponding #
#                     array which you can find by pressing Ctrl+F and entering #
#                     //CUSTOMIZE in the text-box                              #

Terms of Use

Code:
# - Terms of Use: In order to use this script you MUST agree to ALL of the     #
#                 following:                                                   #
#                       >You will credit DeM0nFiRe in any and all projects you #
#                        you use this script in, or any pictures made to go    #
#                        this script                                           #
#                       >The pictures named in the requirements are for this   #
#                        ONLY, and may NOT be used for any other purpose       #
#                       >This script will be used ONLY for non-commercial(free)#
#                        projects. If you would like to use this script in a   #
#                        project for money, contact DeM0nFiRe.                 #

View attachment 2400

View attachment 2401

View attachment 2402

View attachment 2403
 
havent tested yet but if there is no background like in the first example you could make the minimap stick in a position where the black wouldnt be shown

of course it would be a lot of work but it could be a toggable featyure for those who dont want to show backgrounds
 
Yet another powerful Script from DA..
Though, could it be too much to add a feature?
That the mini-map border ajusts to the mini-map's size?
 
Sorry, but the map size is like that for a reason. besides, you can see the entire map, it scrolls automatically when you move.

PS: DA? WHere did those initials come from?
 
Horrible the idea to use the sky as background in the minimap, when the player is standing on the ground!

Why not making an option to choose a picture as background for each tileset/map?

Or just leaving it empty (black)?
 
Wow, thanks alot. You'll know where to find me.

PS: Guys, I forgot to mention, the name of each map picture should be HUD_01_map# where # is the map_id of the map.
 
Oh guys, I just realized, I forgot that in the title screen you need to add this at line 31:

$data_mapinfo = load_data("Data/MapInfos.rxdata")
 
Does it have to be a square (The frame) say, if I made one the shape of a shield, do you reckon that you'd only have the map in the shield shape or would it protrude from the edges of the shield?
 
Sorry, but it would protrude. What you want to do requires something like OpenGL to do that sort of clipping.. You could put a square picture over the map with a hole cut like a shield to show the map ion a shield, but there'd still be a square overall.
 

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