Advertisement
Dekita

Key Menu HUD v1.1

Apr 2nd, 2013
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.10 KB | None | 0 0
  1. if false # << Make true to use this script, false to disable.
  2. #===============================================================================
  3. #
  4. # ☆ $D13x - Key Menu HUD
  5. # -- Author : Dekita
  6. # -- Version : 1.0
  7. # -- Level : Easy / Normal
  8. # -- Requires : $D13x Key Menu v1.1+
  9. # -- Engine : RPG Maker VX Ace.
  10. #
  11. #===============================================================================
  12. # ☆ Import
  13. #-------------------------------------------------------------------------------
  14. $D13x={}if$D13x==nil
  15. $D13x[:Key_Menu]=true
  16. #===============================================================================
  17. # ☆ Updates
  18. #-------------------------------------------------------------------------------
  19. # D /M /Y
  20. # 29/o3/2o13 - Started, Finished,
  21. #
  22. #===============================================================================
  23. # ☆ Introduction
  24. #-------------------------------------------------------------------------------
  25. # This script shows a little HUD for the keys used to trigger each menu item.
  26. # Requires $D13x Key Menu.
  27. #
  28. #===============================================================================
  29. # ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
  30. #===============================================================================
  31. # 1. You MUST give credit to "Dekita" !!
  32. # 2. You are NOT allowed to repost this script.(or modified versions)
  33. # 3. You are NOT allowed to convert this script.
  34. # 4. You are NOT allowed to use this script for Commercial games.
  35. # 5. ENJOY!
  36. #
  37. # "FINE PRINT"
  38. # By using this script you hereby agree to the above terms and conditions,
  39. # if any violation of the above terms occurs "legal action" may be taken.
  40. # Not understanding the above terms and conditions does NOT mean that
  41. # they do not apply to you.
  42. # If you wish to discuss the terms and conditions in further detail you can
  43. # contact me at http://dekitarpg.wordpress.com/
  44. #
  45. #===============================================================================
  46. # ☆ Instructions
  47. #-------------------------------------------------------------------------------
  48. # Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
  49. # Place Below $D13x Key Menu
  50. #
  51. #===============================================================================
  52. module Key_Menu
  53. #===============================================================================
  54.  
  55. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  56. # ☆ Visible HUD Settings
  57. #-----------------------------------------------------------------------------
  58. # You can show a small graphic for each hud item,
  59. # NOTE : the graphic should be about 26x26 pixels in size
  60. # it will be shown below the icon for all visible key icons.
  61. # graphic should be placed in Graphics/System folder
  62. Show_HUD_Graphic = [ false , "GRAPHIC NAME" ] # [ use? , graphic ]
  63.  
  64. # Text Settings, used to adjust various settings for the Key shown
  65. # for each visible menu icon.
  66. # Settings = [ x , y , size, bold , color , outline col ]
  67. Text_Settings = [ 26 , 5 , 18 , true , Text_Color::Grey, Text_Color::Black ]
  68. Text_Opacity = [ 155 , 255 ] # [ not pressed , pressed ]
  69.  
  70. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  71. # ☆ Visible Icon Settings
  72. #-----------------------------------------------------------------------------
  73. # NOTE: will only be shown if the key is not :NONE
  74. # Menu Item = [show?, x , y , icon , icon hue]
  75. Menu_Key_HUD = [true , 0 , 0 , 0 , 0 ]
  76. Pause_Key_HUD = [true , 10 , 100 , 1 , 0 ]
  77. Items_Key_HUD = [true , 10 , 126 , 2 , 0 ]
  78. Skills_Key_HUD = [true , 10 , 152 , 3 , 0 ]
  79. Equips_Key_HUD = [true , 10 , 178 , 4 , 0 ]
  80. Status_Key_HUD = [true , 10 , 204 , 5 , 0 ]
  81. Save_Key_HUD = [true , 10 , 230 , 6 , 0 ]
  82.  
  83. # This is the extra x and y position added to each icon.
  84. Icon_Settings = [ 2 , 2 ] # [ xtra x , xtra y ]
  85.  
  86. end #####################
  87. # CUSTOMISATION END #
  88. #####################
  89. #☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
  90. # #
  91. # http://dekitarpg.wordpress.com/ #
  92. # #
  93. #★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
  94. #===============================================================================#
  95. # ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
  96. # YES?\.\. #
  97. # OMG, REALLY? \| #
  98. # WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
  99. # I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
  100. #===============================================================================#
  101. class KM_HUD < Sprite
  102. #===============================================================================
  103. #--------------------------------------------------------------------------
  104. # Initalize Litte Key HUD
  105. #--------------------------------------------------------------------------
  106. def initialize(key,x,y,icon_id,hue)
  107. super()
  108. create_bg(x,y)
  109. create_icon(x,y,icon_id,hue)
  110. create_letter(x,y,key)
  111. end
  112. #--------------------------------------------------------------------------
  113. # Create BG
  114. #--------------------------------------------------------------------------
  115. def create_bg(x,y)
  116. bg_info = Key_Menu::Show_HUD_Graphic
  117. if bg_info[0] ; self.bitmap = Cache.system(bg_info[1])
  118. else ; self.bitmap = Bitmap.new(26,26) ; end
  119. self.z = 201
  120. self.x = (x)
  121. self.y = (y)
  122. end
  123. #--------------------------------------------------------------------------
  124. # Create Icon
  125. #--------------------------------------------------------------------------
  126. def create_icon(x,y,icon_id,hue)
  127. @icon = Sprite.new
  128. @icon.bitmap = Cache.icon("IconSet", hue)
  129. rect = Rect.new(icon_id % 16 * 24, icon_id / 16 * 24, 24, 24)
  130. @icon.bitmap.blt(0, 0, @icon.bitmap, rect, 255)
  131. @icon.src_rect.set(rect.x, rect.y, 24, 24)
  132. @icon.z = (self.z)
  133. @icon.x = x+Key_Menu::Icon_Settings[0]
  134. @icon.y = y+Key_Menu::Icon_Settings[1]
  135. end
  136. #--------------------------------------------------------------------------
  137. # Create Letter
  138. #--------------------------------------------------------------------------
  139. def create_letter(x,y,key)
  140. @keys = key.to_s
  141. wids = (18 * @keys.size)
  142. @letter = Sprite.new
  143. @letter.bitmap = Bitmap.new(wids,18)
  144. @letter.bitmap.font.name = General::Fonts
  145. @letter.bitmap.font.size = Key_Menu::Text_Settings[2]
  146. @letter.bitmap.font.bold = Key_Menu::Text_Settings[3]
  147. @letter.bitmap.font.color = Key_Menu::Text_Settings[4]
  148. @letter.bitmap.font.out_color = Key_Menu::Text_Settings[5]
  149. @letter.bitmap.draw_text(0,0,wids,18,@keys)
  150. @letter.z = (self.z)
  151. @letter.x = x+Key_Menu::Text_Settings[0]
  152. @letter.y = y+Key_Menu::Text_Settings[1]
  153. @letter.opacity = Key_Menu::Text_Opacity[0]
  154. end
  155. #--------------------------------------------------------------------------
  156. # Dispose Litte Key HUD
  157. #--------------------------------------------------------------------------
  158. def dispose
  159. super
  160. @icon.dispose if @icon
  161. @letter.dispose if @letter
  162. end
  163. #--------------------------------------------------------------------------
  164. # Update Litte Key HUD
  165. #--------------------------------------------------------------------------
  166. def update
  167. super
  168. if Keys.press?(Keys::Key[@keys.to_sym])
  169. @letter.opacity = Key_Menu::Text_Opacity[1]
  170. end
  171. end
  172.  
  173. end
  174.  
  175. #===============================================================================
  176. class Spriteset_Map
  177. #===============================================================================
  178. #--------------------------------------------------------------------------
  179. # Initalize Litte Key HUD
  180. #--------------------------------------------------------------------------
  181. alias :init_KEY_HUD_SM :initialize
  182. alias :updt_KEY_HUD_SM :dispose
  183. alias :disp_KEY_HUD_SM :update
  184. #--------------------------------------------------------------------------
  185. # Initalize Litte Key HUD
  186. #--------------------------------------------------------------------------
  187. def initialize
  188. init_KEY_HUD_SM
  189. create_KEY_HUD
  190. end
  191. #--------------------------------------------------------------------------
  192. # Create Key HUD
  193. #--------------------------------------------------------------------------
  194. def create_KEY_HUD
  195. @key_HUD = []
  196. if Key_Menu::Pause_Key != :NONE && Key_Menu::Pause_Key_HUD[0]
  197. k = Key_Menu::Pause_Key_HUD
  198. @key_HUD << KM_HUD.new(Key_Menu::Pause_Key,k[1],k[2],k[3],k[4])
  199. end
  200. if Key_Menu::Menu_Key != :NONE && Key_Menu::Menu_Key_HUD[0]
  201. k = Key_Menu::Menu_Key_HUD
  202. @key_HUD << KM_HUD.new(Key_Menu::Menu_Key,k[1],k[2],k[3],k[4])
  203. end
  204. if Key_Menu::Items_Key != :NONE && Key_Menu::Items_Key_HUD[0]
  205. k = Key_Menu::Items_Key_HUD
  206. @key_HUD << KM_HUD.new(Key_Menu::Items_Key,k[1],k[2],k[3],k[4])
  207. end
  208. if Key_Menu::Skills_Key != :NONE && Key_Menu::Skills_Key_HUD[0]
  209. k = Key_Menu::Skills_Key_HUD
  210. @key_HUD << KM_HUD.new(Key_Menu::Skills_Key,k[1],k[2],k[3],k[4])
  211. end
  212. if Key_Menu::Equips_Key != :NONE && Key_Menu::Equips_Key_HUD[0]
  213. k = Key_Menu::Equips_Key_HUD
  214. @key_HUD << KM_HUD.new(Key_Menu::Equips_Key,k[1],k[2],k[3],k[4])
  215. end
  216. if Key_Menu::Status_Key != :NONE && Key_Menu::Status_Key_HUD[0]
  217. k = Key_Menu::Status_Key_HUD
  218. @key_HUD << KM_HUD.new(Key_Menu::Status_Key,k[1],k[2],k[3],k[4])
  219. end
  220. if Key_Menu::Save_Key != :NONE && Key_Menu::Save_Key_HUD[0]
  221. k = Key_Menu::Save_Key_HUD
  222. @key_HUD << KM_HUD.new(Key_Menu::Save_Key,k[1],k[2],k[3],k[4])
  223. end
  224. end
  225. #--------------------------------------------------------------------------
  226. # Dispose Litte Key HUD
  227. #--------------------------------------------------------------------------
  228. def dispose
  229. updt_KEY_HUD_SM
  230. if @key_HUD
  231. @key_HUD.each {|kh| kh.dispose }
  232. end
  233. end
  234. #--------------------------------------------------------------------------
  235. # Update Litte Key HUD
  236. #--------------------------------------------------------------------------
  237. def update
  238. disp_KEY_HUD_SM
  239. if @key_HUD
  240. @key_HUD.each {|kh| kh.update }
  241. end
  242. end
  243.  
  244. end
  245.  
  246. #==============================================================================#
  247. # http://dekitarpg.wordpress.com/ #
  248. #==============================================================================#
  249. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement