Advertisement
TroyZ

TroyZ - Jump Extended

Oct 30th, 2014
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.85 KB | None | 0 0
  1. # ==============================================================================
  2. # ▼▼▼▼▼▼                     TroyZ - Jump Extended                        ▼▼▼▼▼▼
  3. # ==============================================================================
  4. # Script by : Agung Prasetyo(TroyZ)
  5. # Contact me by : - Email agung.endisnear.xyz@gmail.com
  6. #                 - Forum RPGMakerID, username TroyZ
  7. #                 - Handphone 085756289121
  8. # Engine : VXAce
  9. # Level : Easy
  10. # Version : 1.0
  11. # ------------------------------------------------------------------------------
  12. # Change Logs :
  13. # 31 October 2014 : Version 1.0 released
  14. # ------------------------------------------------------------------------------
  15. # How this work :
  16. # This script allows you to create jumping events with map coordinates as the
  17. # base.
  18. # ------------------------------------------------------------------------------
  19. # How to use :
  20. # Place it between material and main. Use this script call inside move route
  21. # event :
  22. #
  23. # jump_to_pos(x_pos, y_pos)
  24. #
  25. # Means that this character/event will jump into x and y coordinates at the map.
  26. # For example you put this script call inside player move route at the event :
  27. #
  28. # jump_to_pos(17, 20)
  29. #
  30. # Means that the player will jump into coordinate of x = 17 and y = 20 at the
  31. # map.
  32. # ------------------------------------------------------------------------------
  33. # Compatibility issues :
  34. # None yet. If you found some, let me know, and bug fixes will come out soon.
  35. # ------------------------------------------------------------------------------
  36. # Who to credit :
  37. # - Allah swt. : For the chance of living that he has given to me.
  38. # - Nabi Muhammad saw. : As a leader and messenger and prophet of Muslim.
  39. #                        I'm proud to be your follower. :)
  40. # - Agung Prasetyo(TroyZ) : Thats me, of course, the ones that made this script. :P
  41. # ------------------------------------------------------------------------------
  42. # License :
  43. # - Free Game : Just credit those names above.
  44. # - Commercial Game : Same as free game's license.
  45. # ------------------------------------------------------------------------------
  46. $imported = {} if $imported.nil?
  47. $imported[:TroyZ_JumpExtended] = true
  48. # ------------------------------------------------------------------------------
  49. # There is nothing to config beyond this line
  50. # ------------------------------------------------------------------------------
  51. class Game_Character < Game_CharacterBase
  52.   def jump_to_pos(x_pos, y_pos)
  53.     if x_pos.abs > y_pos.abs
  54.       set_direction(x_pos < @x ? 4 : 6)
  55.     else
  56.       set_direction(y_pos < @y ? 8 : 2)
  57.     end
  58.     @x = x_pos
  59.     @y = y_pos
  60.     distance = Math.sqrt(x_pos * x_pos + y_pos * y_pos).round      
  61.     @jump_peak = 10 + distance - @move_speed
  62.     @jump_count = @jump_peak * 2
  63.     @stop_count = 0
  64.     straighten
  65.   end
  66. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement