Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DeM0nFiRe's HUD_01
#1
DeM0nFiRe's HUD_01
Current Version: V1.0 (08/01/07)

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


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.

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.                 #



Required Files
(Links dead)
}




Users browsing this thread: