Advertisement
diamondandplatinum3

Block Areas From View

Jun 7th, 2014
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.11 KB | None | 0 0
  1. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. #             Block Areas From View
  3. #             Author: DiamondandPlatinum3
  4. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. #  Description:
  6. #
  7. #    This script simply allows you to input stop points for the camera on maps.
  8. #    ie. if you don't want to have the map scroll to a certain area on the map
  9. #    because that's a blank space filled with events or if you just purely don't
  10. #    wish the player to know that area is there yet, you can use this script to
  11. #    stop the player from seeing it.
  12. #
  13. #    This script only affects the camera, if you don't want the player to travel
  14. #    into the unseen area, you'll need to block it off somehow with other things.
  15. #
  16. #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  17. #------------------------------------------------------------------------------
  18. #  Instructions:
  19. #
  20. #  ~  Just below you wish find an editable option allowing you to set up a
  21. #     switch id. By turning this event switch on you can disable the camera
  22. #     barriers and allow your players to see the earlier unseen area(s).
  23. #
  24. #  ~  To set up block points, go into the note boxes for you maps and insert:
  25. #
  26. #                   ~SCROLL_LEFT<?>         <= To Block a Left Area
  27. #                   ~SCROLL_RIGHT<?>        <= To Block a Right Area
  28. #                   ~SCROLL_UP<?>           <= To Block an Upwards Area
  29. #                   ~SCROLL_DOWN<?>         <= To Block an Downwards Area
  30. #
  31. #       Replace the ? with an id of one of the map tiles.
  32. #      
  33. #     Screenshots here:
  34. #            http://i.imgur.com/36luHYZ.png
  35. #            http://i.imgur.com/O47sPWv.png
  36. #
  37. #
  38. #
  39. #  ~  One more thing to note is that the camera starts off wherever the player
  40. #     is. If you spawn the player in an area that is supposed to be blocked to
  41. #     viewing. The camera will get jerky once you start moving it.
  42. #      *   The event switch is there, don't forget.
  43. #
  44. #
  45. #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  46.  
  47.  
  48.  
  49. class Game_Map
  50.   #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51.   #                                                        -=
  52.   #                 Editable Region        ////            ==
  53.   #                                                        =-
  54.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  55.  
  56.   CAMERA_BLOCK_DEACTIVATION_EVENT_SWITCH_ID = 10
  57.  
  58.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  59.   #                                           \/
  60.   #               End of Editable Region      /\
  61.   #                                           \/
  62.   #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=    
  63.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  64.   # * Alias Listings
  65.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  66.   alias dp3_stopscroll_gamemap_setupscroll_90j4y7                setup_scroll
  67.   alias dp3_stopscroll_gamemap_scrolldown_90j4y7                  scroll_down
  68.   alias dp3_stopscroll_gamemap_scrollleft_90j4y7                  scroll_left
  69.   alias dp3_stopscroll_gamemap_scrollright_90j4y7                scroll_right
  70.   alias dp3_stopscroll_gamemap_scrollup_90j4y7                      scroll_up
  71.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  72.   # * Scroll Setup
  73.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  74.   def setup_scroll(*args)
  75.     dp3_stopscroll_gamemap_setupscroll_90j4y7(*args)
  76.    
  77.     @dp3_scroll_stop_points = []
  78.     @dp3_scroll_stop_points[0] = (@map.note =~ /~SCROLL_LEFT<(\d+)>/i)  ? $1.to_f : 0.0
  79.     @dp3_scroll_stop_points[1] = (@map.note =~ /~SCROLL_RIGHT<(\d+)>/i) ? $1.to_f : width.to_f
  80.     @dp3_scroll_stop_points[2] = (@map.note =~ /~SCROLL_UP<(\d+)>/i)    ? $1.to_f : 0.0
  81.     @dp3_scroll_stop_points[3] = (@map.note =~ /~SCROLL_DOWN<(\d+)>/i)  ? $1.to_f : height.to_f
  82.   end
  83.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  84.   # * Scroll Down
  85.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  86.   def scroll_down(*args)
  87.     if $game_switches[CAMERA_BLOCK_DEACTIVATION_EVENT_SWITCH_ID] || loop_vertical? || @dp3_scroll_stop_points[3] == height
  88.       dp3_stopscroll_gamemap_scrolldown_90j4y7(*args)
  89.     else
  90.       last_y = @display_x
  91.       @display_y = [@display_y + args[0], @dp3_scroll_stop_points[3] - screen_tile_y].min
  92.       @parallax_y += @display_y - last_y
  93.     end
  94.   end
  95.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  96.   # * Scroll Left
  97.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  98.   def scroll_left(*args)
  99.     if $game_switches[CAMERA_BLOCK_DEACTIVATION_EVENT_SWITCH_ID] || loop_horizontal? || @dp3_scroll_stop_points[0] == 0
  100.       dp3_stopscroll_gamemap_scrollleft_90j4y7(*args)
  101.     else
  102.       last_x = @display_x
  103.       @display_x = [@display_x - args[0], @dp3_scroll_stop_points[0]].max
  104.       @parallax_x += @display_x - last_x
  105.     end
  106.   end
  107.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  108.   # * Scroll Right
  109.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  110.   def scroll_right(*args)
  111.     if $game_switches[CAMERA_BLOCK_DEACTIVATION_EVENT_SWITCH_ID] || loop_horizontal? || @dp3_scroll_stop_points[1] == width
  112.       dp3_stopscroll_gamemap_scrollright_90j4y7(*args)
  113.     else
  114.       last_x = @display_x
  115.       @display_x = [@display_x + args[0], (@dp3_scroll_stop_points[1] - screen_tile_x)].min
  116.       @parallax_x += @display_x - last_x
  117.     end
  118.   end
  119.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  120.   # * Scroll Up
  121.   #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  122.   def scroll_up(*args)
  123.     if $game_switches[CAMERA_BLOCK_DEACTIVATION_EVENT_SWITCH_ID] || loop_vertical? || @dp3_scroll_stop_points[2] == 0
  124.       dp3_stopscroll_gamemap_scrollup_90j4y7(*args)
  125.     else
  126.       last_y = @display_y
  127.       @display_y = [@display_y - args[0], @dp3_scroll_stop_points[2]].max
  128.       @parallax_y += @display_y - last_y
  129.     end
  130.   end
  131. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement