Advertisement
DaxSoft

MoveScreen

Jul 27th, 2014
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. #==============================================================================
  2. # • Move Screen
  3. #==============================================================================
  4. # Author: Dax
  5. # Requirements: Dax Core
  6. # Version: 1.1
  7. # Site: www.dax-soft.weebly.com
  8. #==============================================================================
  9. # • Descrição:
  10. #------------------------------------------------------------------------------
  11. # Move the screen when is press the key Q(optional), the screen is moved according
  12. # with the arrow keys(optional).
  13. #==============================================================================
  14. Dax.register(:move_screen, "Dax", 1.1) {
  15. #==============================================================================
  16. # • Módulo de configuração.
  17. #==============================================================================
  18. module MoveScreen
  19. #----------------------------------------------------------------------------
  20. # • Setup
  21. #----------------------------------------------------------------------------
  22. KeySwitche = :Q # Key to the press.
  23. # You can turn off the script, just torn on the switch that you define.
  24. IdSwitche = 1
  25. Keys = [ # Keys that will move the screen.
  26. :UP, :LEFT, :RIGHT, :DOWN,
  27. ]
  28. Distance = 1 # Distance travaled
  29. Speed = 3 # Speed
  30. Directions = [8, 4, 6, 2] # Direction
  31. end
  32. #==============================================================================
  33. # • Game_Player
  34. #==============================================================================
  35. class Game_Player
  36. #----------------------------------------------------------------------------
  37. # • Processamento de movimento através de pressionar tecla
  38. #----------------------------------------------------------------------------
  39. alias :moveScreen_move_by_input :move_by_input
  40. def move_by_input(*args, &block)
  41. return if $game_map.moveScreen
  42. moveScreen_move_by_input(*args, &block)
  43. end
  44. end
  45. #==============================================================================
  46. # • Game_Map
  47. #==============================================================================
  48. class Game_Map
  49. #----------------------------------------------------------------------------
  50. # • Mover a tela.
  51. #----------------------------------------------------------------------------
  52. def moveScreen
  53. return if $game_switches[MoveScreen::IdSwitche]
  54. press?(MoveScreen::KeySwitche) {
  55. MoveScreen::Keys.each_with_index { |keys, id|
  56. press?(keys) { self.start_scroll(MoveScreen::Directions[id], MoveScreen::Distance, MoveScreen::Speed) }
  57. }
  58. return true
  59. }
  60. return false
  61. end
  62. #----------------------------------------------------------------------------
  63. # • Processo de atualização.
  64. #----------------------------------------------------------------------------
  65. alias :movescreen_update :update
  66. def update(*args, &block)
  67. movescreen_update(*args, &block)
  68. self.moveScreen
  69. end
  70. end
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement