Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Munkis' Reserved Space for HUD, Mainly for use with ABS scripts
munkis
post Jul 13 2011, 11:59 AM
Post #1


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Munkis' Reserved Space for HUD

Version: 1.1
Author: Munkis
Release Date: 07/13/2011


Exclusive Script at RPG RPG Revolution


Introduction
Creates an impassible region at the bottom that you can use for an ABS HUD.

Features
Just shows a black box at the bottom of the screen that the player can't walk into.

Script
Reserved Space for HUD
CODE
#------------------------------------------------------------------------------
#  * Munkis' Reserved Space for HUD V 1.1
#  * Made by munkis
#    ╔══════════╗
#    ║ FEATURES ║
#    ╚══════════╝
#  * Creates an impassible region at the bottom and/or that you can use for an
#    ABS HUD.  Should be compatible with all ABS scripts, but I can't swear to
#    it.  If you have any issues, just drop me a line at RRR.
#  * OVERWRITES scroll_down, scroll_right, scroll_left, and scroll_up methods
#    of Game_Map.
#  * V 1.0: Initial release
#  * V 1.1: Added ability to create a vertical HUD, as well as move the map
#           window around if you shrank it in both directions.  This version
#           only changes the scroll methods of Game_Map; so pictures and
#           animations will display outside of the map area, that way you can
#           use simple "Show Picture" event commands to display the static HUD
#           graphics.  This methodology also maintains compatibility with
#           scripts that use an in-game map for the title screen (messing with
#           the viewports left black bars on the screen; not a good look for a
#           title screen).
#         **NOTE:  With this version, as you approach the edges
#           of the map, you may notice the map attempt to loop in that
#           direction, even though your character can't move with the map.
#           This is normal; just make sure your HUD graphics cover these areas.
#------------------------------------------------------------------------------
module MNK_HUDSpace

  #Size of scrollable area (in pixels). 32 pixels = 1 tile.
  #[X co-ordinate, Y co-ordinate, width, height].
  AREA_SIZE = [96,32,32,32]
  
end
class Game_Map
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
    else
      last_y = @display_y
      @display_y = [@display_y + distance, (height - (13 - (MNK_HUDSpace::AREA_SIZE[1]/32)))*256].min
      @parallax_y += @display_y - last_y
    end
  end
  def scroll_left(distance)
    if loop_horizontal?
      @display_x += @map.width * 256 - distance
      @display_x %= @map.width * 256
      @parallax_x -= distance
    else
      last_x = @display_x
      @display_x = [@display_x - distance, -(MNK_HUDSpace::AREA_SIZE[2]/32)*256].max
      @parallax_x += @display_x - last_x
    end
  end
  def scroll_up(distance)
    if loop_vertical?
      @display_y += @map.height * 256 - distance
      @display_y %= @map.height * 256
      @parallax_y -= distance
    else
      last_y = @display_y
      @display_y = [@display_y - distance, -(MNK_HUDSpace::AREA_SIZE[3]/32)*256].max
      @parallax_y += @display_y - last_y
    end
  end
  def scroll_right(distance)
    if loop_horizontal?
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
    else
      last_x = @display_x
      @display_x = [@display_x + distance, (width - (17 - (MNK_HUDSpace::AREA_SIZE[0]/32)))*256].min
      @parallax_x += @display_x - last_x
    end
  end
end
class Game_Player < Game_Character
  @CENTER_X = ((Graphics.width - MNK_HUDSpace::AREA_SIZE[0]) / 2 - 16) * 8
  @CENTER_Y = ((Graphics.height - MNK_HUDSpace::AREA_SIZE[1]) / 2 - 16) * 8
end


Resize & Scale compatible Version
CODE
#------------------------------------------------------------------------------
#  * Munkis' Reserved Space for HUD -- Resize & Scale Compatible Version V 1.1
#  * Made by munkis
#    ╔══════════╗
#    ║ FEATURES ║
#    ╚══════════╝
#  * Creates an impassible reigion at the bottom that you can use for an ABS
#    HUD.  Should be compatible with all ABS scripts, but I can't swear to it.
#    If you have any issues, just drop me a line at RRR.  This version is
#    designed to work with Originalwij's Resize & Scale.
#  * OVERWRITES scroll_down, scroll_right, scroll_left, and scroll_up methods
#    of Game_Map.
#  * V 1.0: Initial release
#  * V 1.1: Added ability to create a vertical HUD, as well as move the map
#           window around if you shrank it in both directions.  This version
#           only changes the scroll methods of Game_Map; so pictures and
#           animations will display outside of the map area, that way you can
#           use simple "Show Picture" event commands to display the static HUD
#           graphics.  This methodology also maintains compatibility with
#           scripts that use an in-game map for the title screen (messing with
#           the viewports left black bars on the screen; not a good look for a
#           title screen).
#         **NOTE:  With this version, as you approach the edges
#           of the map, you may notice the map attempt to loop in that
#           direction, even though your character can't move with the map.
#           This is normal; just make sure your HUD graphics cover these areas.
#------------------------------------------------------------------------------
module MNK_HUDSpace

  #Size of scrollable area (in pixels). 32 pixels = 1 tile.
  #[X co-ordinate, Y co-ordinate, width, height].
  AREA_SIZE = [128,96,96,96]

  
end
class Game_Map
  def scroll_down(distance)
    if loop_vertical?
      @display_y += distance
      @display_y %= @map.height * 256
      @parallax_y += distance
    else
      last_y = @display_y
      h = (Graphics.height / 32) - ((MNK_HUDSpace::AREA_SIZE[0] + 8) / 32)
      @display_y = [@display_y + distance, (height - h) * 256].min
      @parallax_y += @display_y - last_y
    end
  end
  def scroll_left(distance)
    if loop_horizontal?
      @display_x += @map.width * 256 - distance
      @display_x %= @map.width * 256
      @parallax_x -= distance
    else
      last_x = @display_x
      @display_x = [@display_x - distance, -(MNK_HUDSpace::AREA_SIZE[2]/32)*256].max
      @parallax_x += @display_x - last_x
    end
  end
  def scroll_up(distance)
    if loop_vertical?
      @display_y += @map.height * 256 - distance
      @display_y %= @map.height * 256
      @parallax_y -= distance
    else
      last_y = @display_y
      @display_y = [@display_y - distance, -(MNK_HUDSpace::AREA_SIZE[1]/32)*256].max
      @parallax_y += @display_y - last_y
    end
  end
  def scroll_right(distance)
    if loop_horizontal?
      @display_x += distance
      @display_x %= @map.width * 256
      @parallax_x += distance
    else
      last_x = @display_x
      w = (Graphics.width / 32) - ((MNK_HUDSpace::AREA_SIZE[3] + 8) / 32)
      @display_x = [@display_x + distance, (width - w) * 256].min
      @parallax_x += @display_x - last_x
    end
  end
end
class Game_Player < Game_Character
  @center_x = (((OW_RaS::WIDTH - MNK_HUDSpace::AREA_SIZE[0]) - MNK_HUDSpace::AREA_SIZE[0]) / 2 - 16) * 8
  @center_y = (((OW_RaS::HEIGHT - MNK_HUDSpace::AREA_SIZE[1]) - MNK_HUDSpace::AREA_SIZE[1]) / 2 - 16) * 8
end


Customization
not a whole lot to customize here; you can change the size of the impassible region (in pixels), but that's it.

Compatibility
OVERWRITES create_viewports and update_viewports methods of Spriteset_Map, as well as the scroll_down method of Game_Map.

Screenshot

(This screenshot is out-dated. As of V 1.1, There are no more black bars created at the edges of the screen.)

DEMO
Shouldn't need one...

Installation
Place in MATERIALS, above MAIN. Put the Resize & Scale compatible version under the script it was made for.

FAQ
Q: ZOMG teh scripz doesn't werk!!!
A: First of all, be more specific, Second, all reports typed in chat-speak or 1337-speak will be ignored.

Terms and Conditions
I don't mind if this script is posted or linked on other RMVX sites AS LONG AS YOU GIVE CREDIT!!! Same goes for using this in your project. Contact me if you want to use this in a commercial project.

Credits
Credit me (munkis) for the script. Kread-EX helped with a lot of it, so you should probably credit him too.

This post has been edited by munkis: Aug 15 2011, 10:51 AM


__________________________
Go to the top of the page
 
+Quote Post
   
dartdaman
post Jul 14 2011, 11:45 AM
Post #2


Level 6
Group Icon

Group: Member
Posts: 77
Type: Developer
RM Skill: Skilled




can you make it where this script can be turned on and off by a switch

This post has been edited by dartdaman: Jul 14 2011, 11:45 AM


__________________________
Go to the top of the page
 
+Quote Post
   
munkis
post Jul 14 2011, 05:42 PM
Post #3


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




I'll add that to the list. I'm already looking at shrinking the map sideways and being able to move the resized window around.


__________________________
Go to the top of the page
 
+Quote Post
   
Helios
post Jul 15 2011, 05:44 AM
Post #4


Level 4
Group Icon

Group: Member
Posts: 54
Type: None
RM Skill: Undisclosed




Honestly, the game's default window size is already a bit too small, no need to narrow it down any further.

Personally I prefer HUD with transparent background, but if you really need a solid one, try to make it vertical, as this will allow players to have near-equal vision range in all direction.

This post has been edited by Helios: Jul 15 2011, 05:44 AM


__________________________
ERROR: NO ERROR DETECTED
Go to the top of the page
 
+Quote Post
   
munkis
post Jul 17 2011, 05:59 AM
Post #5


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




That's why I included the Resize & Scale Compatible version, in case you thought the map was too small. But you can change the size of the black box from within the config module; just change the value of AREA_SIZE to whatever you want it to be.


__________________________
Go to the top of the page
 
+Quote Post
   
Biohazard
post Jul 19 2011, 03:20 AM
Post #6


Level 3
Group Icon

Group: Member
Posts: 42
Type: Writer
RM Skill: Skilled




This is awesome for the text box in my game that is always on screen. Beats using pictures. Thanks for making this!


__________________________
I.R.S.: We've got what it takes to take what you've got!


Go to the top of the page
 
+Quote Post
   
munkis
post Aug 8 2011, 09:34 AM
Post #7


Woah, dude...
Group Icon

Group: Revolutionary
Posts: 197
Type: Writer
RM Skill: Intermediate




Updated both scripts to V 1.1


__________________________
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 24th May 2013 - 07:27 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker