Advanced 8-Directional Movement Script

Advanced 8-Directional Movement
Version: 3.01


Introduction

This script allows for a more extensive 8 directional movement system than comes default with RMXP. It also improves the diagonal sprite movements. This script also affects events as well as the player. It also has the option to toggle between five different methods of movement:
  • Default 4-directional Movement - Using the arrow keys and numberpad, the player can move in only four directions.
  • Default 8-directional Movement - Using the arrow keys and numberpad, the player can move in all eight directions.
  • Point and Click Movement - Using Near_Fantastica's Mouse Module along with his Pathfinding Script and Aleworks Input Module, the player may move his character with the mouse.
  • Axial Movement - The player turns 45 degrees using the left and right arrows and move forward or backward using the up or down arrow respectively.
    This is ideal for airships, boats, or other vehicles. It can also be used with numpad movement and/or mouse movement.
  • Movement Control using Numpad - The player uses the numpad to move in all 8 directions.
    This is ideal in case you wish to use the arrow keys for something other than movement or if you want to use axial movement also.
Also, character sprites now must include 8 poses: one for each direction, in the following order:
.  Lower Left
Down
Lower Right
Left
Right
Upper Left
Up
Upper Right


Screenshots

See the Demo

Demo

Available in the Download Mananger
Also available from Geocities

Script
Required Scripts Show
SDK version 2.2 or greater
Alworks Input Module version 2.0 or greater
Near Fantastica's Pathfinding script Modified by me can be found in the demo.
[quote=Near Fantastica's Mouse Module version 5.0]
  1. #==============================================================================
  2. # ** Mouse Input Module
  3. #------------------------------------------------------------------------------
  4. # Near Fantastica
  5. # Version 5
  6. # 01.03.06
  7. #------------------------------------------------------------------------------
  8. # This module defines mouse input
  9. #==============================================================================
  10.  
  11. #------------------------------------------------------------------------------
  12. # * SDK Log Script
  13. #------------------------------------------------------------------------------
  14. SDK.log("Mouse Input", "Near Fantastica", 5, "01.03.06")
  15.  
  16. #------------------------------------------------------------------------------
  17. # * Begin SDK Enable Test
  18. #------------------------------------------------------------------------------
  19. if SDK.state("Mouse Input") == true
  20.  
  21. module Mouse
  22.   @position
  23.   GSM = Win32API.new('user32', 'GetSystemMetrics', 'i', 'i')
  24.   Cursor_Pos= Win32API.new('user32', 'GetCursorPos', 'p', 'i')
  25.   Scr2cli = Win32API.new('user32', 'ScreenToClient', %w(l p), 'i')
  26.   Client_rect = Win32API.new('user32', 'GetClientRect', %w(l p), 'i')
  27.   Readini = Win32API.new('kernel32', 'GetPrivateProfileStringA', %w(p p p p l p), 'l')
  28.   Findwindow = Win32API.new('user32', 'FindWindowA', %w(p p), 'l')
  29.   #--------------------------------------------------------------------------  
  30.   def Mouse.grid
  31.     return nil if @pos == nil
  32.     offsetx = $game_map.display_x / 4
  33.     offsety = $game_map.display_y / 4
  34.     x = (@pos[0] + offsetx) / 32
  35.     y = (@pos[1] + offsety) / 32
  36.     return [x, y]
  37.   end
  38.   #--------------------------------------------------------------------------  
  39.   def Mouse.position
  40.     return @pos == nil ? [0, 0] : @pos
  41.   end
  42.   #--------------------------------------------------------------------------  
  43.   def Mouse.global_pos
  44.     pos = [0, 0].pack('ll')
  45.     if Cursor_Pos.call(pos) != 0
  46.       return pos.unpack('ll')
  47.     else
  48.       return nil
  49.     end
  50.   end
  51.   #--------------------------------------------------------------------------  
  52.   def Mouse.pos
  53.     x, y = Mouse.screen_to_client(*Mouse.global_pos)
  54.     width, height = Mouse.client_size
  55.     begin
  56.       if (x >= 0 and y >= 0 and x < width and y < height)
  57.         return x, y
  58.       else
  59.         return nil
  60.       end
  61.     rescue
  62.       return nil
  63.     end
  64.   end
  65.   #--------------------------------------------------------------------------  
  66.   def Mouse.update
  67.     @pos = Mouse.pos
  68.   end
  69.   #--------------------------------------------------------------------------  
  70.   def Mouse.screen_to_client(x, y)
  71.     return nil unless x and y
  72.     pos = [x, y].pack('ll')
  73.     if Scr2cli.call(Mouse.hwnd, pos) != 0
  74.       return pos.unpack('ll')
  75.     else
  76.       return nil
  77.     end
  78.   end
  79.   #--------------------------------------------------------------------------  
  80.   def Mouse.hwnd
  81.     game_name = "\0" * 256
  82.     Readini.call('Game','Title','',game_name,255,".\\Game.ini")
  83.     game_name.delete!("\0")
  84.     return Findwindow.call('RGSS Player',game_name)
  85.   end
  86.   #--------------------------------------------------------------------------  
  87.   def Mouse.client_size
  88.     rect = [0, 0, 0, 0].pack('l4')
  89.     Client_rect.call(Mouse.hwnd, rect)
  90.     right, bottom = rect.unpack('l4')[2..3]
  91.     return right, bottom
  92.   end
  93. end
  94.  
  95. #------------------------------------------------------------------------------
  96. # * End SDK Enable Test
  97. #------------------------------------------------------------------------------
  98. end
Expand to see the code.
[/quote]

Advanced 8-D Movement Script Show
  1. #============================================================================
  2. # ** Advanced 8-D Movement
  3. #----------------------------------------------------------------------------
  4. # Draycos Goldaryn
  5. # Version 3.01
  6. # 4-30-07
  7. # SDK Version : 2.2 - Parts 1, 2, 3
  8. #------------------------------------------------------------------------------
  9. # This script allows for a more extensive 8 directional movement system than
  10. # comes default with RMXP. It also improves the diagonal sprite movements.
  11. # This script also affects events as well as the player. It also has the option
  12. # to toggle between five different methods of movement:
  13. #   Default 4-directional Movement
  14. #     Using the arrow keys and numberpad, the player can move in only four
  15. #     directions.
  16. #   Default 8-directional Movement
  17. #     Using the arrow keys and numberpad, the player can move in all eight
  18. #     directions.
  19. #   Point and Click Movement
  20. #     Using Near_Fantastica's Mouse Module along with his Pathfinding Script,
  21. #     and Aleworks Input Module the player may move his character with the
  22. #     mouse.
  23. #   Axial Movement
  24. #     The player turns 45? using the left and right arrows and move forward or
  25. #     backward using the up or down arrow respectively.
  26. #     This is ideal for airships, boats, or other vehicles. It can also be used
  27. #     with numpad movement and/or mouse movement
  28. #   Movement Control using Numpad
  29. #     The player uses the numpad to move in all 8 directions according to the
  30. #     following diagram:
  31. #         \  |  /
  32. #          7 8 9
  33. #         -4   6-
  34. #          1 2 3
  35. #         /  |  \
  36. #     This is ideal in case you wish to use the arrow keys for something other
  37. #     than movement or if you want to use axial movement also.
  38. #
  39. # Also, character sprites now must include 8 poses: one for each direction, in
  40. # the following order:
  41. #   Lower Left
  42. #   Down
  43. #   Lower Right
  44. #   Left
  45. #   Right
  46. #   Upper Left
  47. #   Up
  48. #   Upper Right
  49. #------------------------------------------------------------------------------
  50. # Syntax:
  51. #   To toggle the different methods of movement on, call the following scripts:
  52. #     Default 8-directional movement  : $game_system.default_movement = true
  53. #     Point and Click movement        : $game_system.mouse_movement = true
  54. #     Axial Movement                  : $game_system.axial_movement = true
  55. #     Movement Control using Numpad   : $game_system.numpad_movement = true
  56. #
  57. #   If you want to use only 4-directional movement, then set all the previous
  58. #   mentioned variables to false.
  59. #   NOTE: Triggering Axial Movement will disable both Default Movements. This
  60. #         is to avoid conlficts between them.
  61. #=============================================================================
  62.  
  63. #-----------------------------------------------------------------------------
  64. # * SDK Log Script
  65. #-----------------------------------------------------------------------------
  66. SDK.log('Advanced 8-D Movement', 'Draycos Goldaryn', 3.01, '4-30-07')
  67. SDK.check_requirements(2.20, [1, 2, 3], {'Aleworks Keys Module' => 1.10,
  68.                                       'Path Finding' => 1.5,
  69.                                       'Mouse Input' => 5})
  70.  
  71. #-----------------------------------------------------------------------------
  72. # * Begin SDK Enable Test
  73. #-----------------------------------------------------------------------------
  74. if SDK.enabled?('Advanced 8-D Movement')
  75.  
  76. #-----------------------------------------------------------------------------
  77. # * Module Input
  78. #-----------------------------------------------------------------------------
  79. module Input
  80.   def Input.axial_dir8
  81.     return 1 if Input.press?([[Keys::DOWN, Keys::LEFT]])
  82.     return 3 if Input.press?([[Keys::DOWN, Keys::RIGHT]])
  83.     return 7 if Input.press?([[Keys::UP, Keys::LEFT]])
  84.     return 9 if Input.press?([[Keys::UP, Keys::RIGHT]])
  85.     return 2 if Input.press?(Keys::DOWN)
  86.     return 4 if Input.press?(Keys::LEFT)
  87.     return 6 if Input.press?(Keys::RIGHT)
  88.     return 8 if Input.press?(Keys::UP)
  89.     0
  90.   end
  91. end
  92.  
  93. #-----------------------------------------------------------------------------
  94. # * SDK::Scene Base
  95. #-----------------------------------------------------------------------------
  96. class SDK::Scene_Base
  97.   alias_method(:advanced_8d_movement_scene_base_update, :update)
  98.   def update
  99.     Mouse.update
  100.     advanced_8d_movement_scene_base_update
  101.   end
  102. end
  103.  
  104. #-----------------------------------------------------------------------------
  105. # * Game System
  106. #-----------------------------------------------------------------------------
  107. class Game_System
  108.   attr_accessor :wait
  109.   #Setup movement input type toggles
  110.   attr_accessor :default_movement #Toggles Default Movement
  111.   attr_accessor :mouse_movement   #Toggles Mouse Movement
  112.   attr_accessor :axial_movement   #Toggles Axial Movement
  113.   attr_accessor :numpad_movement  #Toggles Numpad Movement
  114.  
  115.   alias_method (:advanced_8d_movement_game_system_initialize, :initialize)
  116.   def initialize
  117.     advanced_8d_movement_game_system_initialize
  118.     @wait = 0
  119.     #Set the movement input type toggles to default (true = on, false = off)
  120.     @default_movement = true
  121.     @mouse_movement = false
  122.     @axial_movement = false
  123.     @numpad_movement = false
  124.   end
  125. end
  126.  
  127. #-----------------------------------------------------------------------------
  128. # * Game System
  129. #-----------------------------------------------------------------------------
  130. class Game_Character
  131.   #--------------------------------------------------------------------------
  132.   # * SDK Log Overwritten Methods
  133.   #--------------------------------------------------------------------------
  134.   SDK.log_overwrite(:Game_Character, :move_lower_left)
  135.   SDK.log_overwrite(:Game_Character, :move_lower_right)
  136.   SDK.log_overwrite(:Game_Character, :move_upper_left)
  137.   SDK.log_overwrite(:Game_Character, :move_upper_right)
  138.   SDK.log_overwrite(:Game_Character, :move_random)
  139.   SDK.log_overwrite(:Game_Character, :move_forward)
  140.   SDK.log_overwrite(:Game_Character, :move_backward)
  141.   SDK.log_overwrite(:Game_Character, :move_toward_player)
  142.   SDK.log_overwrite(:Game_Character, :move_away_from_player)
  143.   SDK.log_overwrite(:Game_Character, :jump)
  144.   SDK.log_overwrite(:Game_Character, :turn_right_90)
  145.   SDK.log_overwrite(:Game_Character, :turn_left_90)
  146.   SDK.log_overwrite(:Game_Character, :turn_180)
  147.   SDK.log_overwrite(:Game_Character, :turn_right_or_left_90)
  148.   SDK.log_overwrite(:Game_Character, :turn_random)
  149.   SDK.log_overwrite(:Game_Character, :turn_toward_player)
  150.   SDK.log_overwrite(:Game_Character, :turn_away_from_player)
  151.   #--------------------------------------------------------------------------
  152.   # * Move Lower Left
  153.   #--------------------------------------------------------------------------
  154.   def move_lower_left(turn_enabled = true)
  155.     # Turn up
  156.     if turn_enabled
  157.       turn_lower_left
  158.     end
  159.     # When a down to left or a left to down course is passable
  160.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 4)) or
  161.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 2))
  162.       # Update coordinates
  163.       @x -= 1
  164.       @y += 1
  165.       # Increase steps
  166.       increase_steps
  167.     # If impassable
  168.     else
  169.       # Determine if touch event is triggered
  170.       check_event_trigger_touch(@x-1, @y+1)
  171.     end
  172.   end
  173.   #--------------------------------------------------------------------------
  174.   # * Move Lower Right
  175.   #--------------------------------------------------------------------------
  176.   def move_lower_right(turn_enabled = true)
  177.     # Turn up
  178.     if turn_enabled
  179.       turn_lower_right
  180.     end
  181.     # When a down to right or a right to down course is passable
  182.     if (passable?(@x, @y, 2) and passable?(@x, @y + 1, 6)) or
  183.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 2))
  184.       # Update coordinates
  185.       @x += 1
  186.       @y += 1
  187.       # Increase steps
  188.       increase_steps
  189.     # If impassable
  190.     else
  191.       # Determine if touch event is triggered
  192.       check_event_trigger_touch(@x+1, @y+1)
  193.     end
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # * Move Upper Left
  197.   #--------------------------------------------------------------------------
  198.   def move_upper_left(turn_enabled = true)
  199.     # Turn up
  200.     if turn_enabled
  201.       turn_upper_left
  202.     end
  203.     # When an up to left or a left to up course is passable
  204.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 4)) or
  205.        (passable?(@x, @y, 4) and passable?(@x - 1, @y, 8))
  206.       # Update coordinates
  207.       @x -= 1
  208.       @y -= 1
  209.       # Increase steps
  210.       increase_steps
  211.     # If impassable
  212.     else
  213.       # Determine if touch event is triggered
  214.       check_event_trigger_touch(@x-1, @y-1)
  215.     end
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # * Move Upper Right
  219.   #--------------------------------------------------------------------------
  220.   def move_upper_right(turn_enabled = true)
  221.     # Turn up
  222.     if turn_enabled
  223.       turn_upper_right
  224.     end
  225.     # When an up to right or a right to up course is passable
  226.     if (passable?(@x, @y, 8) and passable?(@x, @y - 1, 6)) or
  227.        (passable?(@x, @y, 6) and passable?(@x + 1, @y, 8))
  228.       # Update coordinates
  229.       @x += 1
  230.       @y -= 1
  231.       # Increase steps
  232.       increase_steps
  233.     # If impassable
  234.     else
  235.       # Determine if touch event is triggered
  236.       check_event_trigger_touch(@x+1, @y-1)
  237.     end
  238.   end
  239.   #--------------------------------------------------------------------------
  240.   # * Move at Random
  241.   #--------------------------------------------------------------------------
  242.   def move_random
  243.     case rand(8)
  244.     when 0  # Move down
  245.       move_down
  246.     when 1  # Move left
  247.       move_left
  248.     when 2  # Move right
  249.       move_right
  250.     when 3  # Move up
  251.       move_up
  252.     when 4
  253.       move_lower_left
  254.     when 5
  255.       move_lower_right
  256.     when 6
  257.       move_upper_left
  258.     when 7
  259.       move_upper_right
  260.     end
  261.   end
  262.   #--------------------------------------------------------------------------
  263.   # * Move toward Player
  264.   #--------------------------------------------------------------------------
  265.   def move_toward_player
  266.     # Get difference in player coordinates
  267.     sx = @x - $game_player.x
  268.     sy = @y - $game_player.y
  269.     # If coordinates are equal
  270.     if sx == 0 and sy == 0
  271.       return
  272.     end
  273.     # Get absolute value of difference
  274.     abs_sx = sx.abs
  275.     abs_sy = sy.abs
  276.     #get diagonal differences
  277.     sh = (abs_sx / 2) - abs_sy
  278.     sv = (abs_sy / 2) - abs_sx
  279.     # Is the player more towards a 45? angle?
  280.     if abs_sx == abs_sy || (sv < 0 and sh < 0)
  281.       if $game_player.y > @y
  282.         #if the player is lower left
  283.         if $game_player.x < @x
  284.           move_lower_left
  285.         #If the player is lower right
  286.         else
  287.           move_lower_right
  288.         end
  289.       else
  290.         #if the player is upper left
  291.         if $game_player.x < @x
  292.           move_upper_left
  293.         #if the player is upper right
  294.         else
  295.           move_upper_right
  296.         end
  297.       end
  298.     # If horizontal distance is longer
  299.     elsif abs_sx > abs_sy
  300.       # Move towards player, prioritize left and right directions
  301.       sx > 0 ? move_left : move_right
  302.       if not moving? and sy != 0
  303.         sy > 0 ? move_up : move_down
  304.       end
  305.     # If vertical distance is longer
  306.     else
  307.       # Move towards player, prioritize up and down directions
  308.       sy > 0 ? move_up : move_down
  309.       if not moving? and sx != 0
  310.         sx > 0 ? move_left : move_right
  311.       end
  312.     end
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # * Move away from Player
  316.   #--------------------------------------------------------------------------
  317.   def move_away_from_player
  318.     # Get difference in player coordinates
  319.     sx = @x - $game_player.x
  320.     sy = @y - $game_player.y
  321.     # If coordinates are equal
  322.     if sx == 0 and sy == 0
  323.       return
  324.     end
  325.     # Get absolute value of difference
  326.     abs_sx = sx.abs
  327.     abs_sy = sy.abs
  328.     #get diagonal differences
  329.     sh = (abs_sx / 2) - abs_sy
  330.     sv = (abs_sy / 2) - abs_sx
  331.     # Is the player more towards a 45? angle?
  332.     if abs_sx == abs_sy || (sv < 0 and sh < 0)
  333.       if $game_player.y > @y
  334.         #if the player is lower left
  335.         if $game_player.x < @x
  336.           move_upper_right
  337.         #If the player is lower right
  338.         else
  339.           move_upper_left
  340.         end
  341.       else
  342.         #if the player is upper left
  343.         if $game_player.x < @x
  344.           move_lower_right
  345.         #if the player is upper right
  346.         else
  347.           move_lower_left
  348.         end
  349.       end
  350.     # If horizontal distance is longer
  351.     elsif abs_sx > abs_sy
  352.       # Move away from player, prioritize left and right directions
  353.       sx > 0 ? move_right : move_left
  354.       if not moving? and sy != 0
  355.         sy > 0 ? move_down : move_up
  356.       end
  357.     # If vertical distance is longer
  358.     else
  359.       # Move away from player, prioritize up and down directions
  360.       sy > 0 ? move_down : move_up
  361.       if not moving? and sx != 0
  362.         sx > 0 ? move_right : move_left
  363.       end
  364.     end
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # * 1 Step Forward
  368.   #--------------------------------------------------------------------------
  369.   def move_forward
  370.     case @direction
  371.     when 2
  372.       move_down(false)
  373.     when 4
  374.       move_left(false)
  375.     when 6
  376.       move_right(false)
  377.     when 8
  378.       move_up(false)
  379.     when 1 #lower left
  380.       move_lower_left(false)
  381.     when 3 #lower right
  382.       move_lower_right(false)
  383.     when 7 #upper left
  384.       move_upper_left(false)
  385.     when 9 #upper right
  386.       move_upper_right(false)
  387.     end
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # * 1 Step Backward
  391.   #--------------------------------------------------------------------------
  392.   def move_backward
  393.     # Remember direction fix situation
  394.     last_direction_fix = @direction_fix
  395.     # Force directino fix
  396.     @direction_fix = true
  397.     # Branch by direction
  398.     case @direction
  399.     when 2  # Down
  400.       move_up(false)
  401.     when 4  # Left
  402.       move_right(false)
  403.     when 6  # Right
  404.       move_left(false)
  405.     when 8  # Up
  406.       move_down(false)
  407.     when 1 #lower left
  408.       move_upper_right(false)
  409.     when 3 #lower right
  410.       move_upper_left(false)
  411.     when 7 #upper left
  412.       move_lower_right(false)
  413.     when 9 #upper right
  414.       move_lower_left(false)
  415.     end
  416.     # Return direction fix situation back to normal
  417.     @direction_fix = last_direction_fix
  418.   end
  419.   #--------------------------------------------------------------------------
  420.   # * Jump
  421.   #     x_plus : x-coordinate plus value
  422.   #     y_plus : y-coordinate plus value
  423.   #--------------------------------------------------------------------------
  424.   def jump(x_plus, y_plus)
  425.     # If plus value is not (0,0)
  426.     if x_plus != 0 or y_plus != 0
  427.       # If horizontal distnace is longer
  428.       if x_plus.abs > y_plus.abs
  429.         # Change direction to left or right
  430.         x_plus < 0 ? turn_left : turn_right
  431.       # If vertical distance is longer
  432.       elsif x_plus.abs < y_plus.abs
  433.         # Change direction to up or down
  434.         y_plus < 0 ? turn_up : turn_down
  435.       # if distances are equal
  436.       else
  437.         if x_plus < 0
  438.           if y_plus < 0
  439.             turn_upper_left
  440.           else
  441.             turn_lower_left
  442.           end
  443.         else
  444.           if y_plus < 0
  445.             turn_upper_right
  446.           else
  447.             turn_lower_right
  448.           end
  449.         end
  450.       end
  451.     end
  452.     # Calculate new coordinates
  453.     new_x = @x + x_plus
  454.     new_y = @y + y_plus
  455.     # If plus value is (0,0) or jump destination is passable
  456.     if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
  457.       # Straighten position
  458.       straighten
  459.       # Update coordinates
  460.       @x = new_x
  461.       @y = new_y
  462.       # Calculate distance
  463.       distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
  464.       # Set jump count
  465.       @jump_peak = 10 + distance - @move_speed
  466.       @jump_count = @jump_peak * 2
  467.       # Clear stop count
  468.       @stop_count = 0
  469.     end
  470.   end
  471.   #--------------------------------------------------------------------------
  472.   # * Turn Lower Left
  473.   #--------------------------------------------------------------------------
  474.   def turn_lower_left
  475.     unless @direction_fix
  476.       @direction = 1
  477.       @stop_count = 0
  478.     end
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # * Turn Lower Right
  482.   #--------------------------------------------------------------------------
  483.   def turn_lower_right
  484.     unless @direction_fix
  485.       @direction = 3
  486.       @stop_count = 0
  487.     end
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # * Turn Upper Left
  491.   #--------------------------------------------------------------------------
  492.   def turn_upper_left
  493.     unless @direction_fix
  494.       @direction = 7
  495.       @stop_count = 0
  496.     end
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # * Turn Upper Right
  500.   #--------------------------------------------------------------------------
  501.   def turn_upper_right
  502.     unless @direction_fix
  503.       @direction = 9
  504.       @stop_count = 0
  505.     end
  506.   end
  507.   #--------------------------------------------------------------------------
  508.   # * Turn 90? Right
  509.   #--------------------------------------------------------------------------
  510.   def turn_right_90
  511.     case @direction
  512.     when 2
  513.       turn_left
  514.     when 4
  515.       turn_up
  516.     when 6
  517.       turn_down
  518.     when 8
  519.       turn_right
  520.     when 1
  521.       turn_upper_left
  522.     when 3
  523.       turn_lower_left
  524.     when 7
  525.       turn_upper_right
  526.     when 9
  527.       turn_lower_right
  528.     end
  529.   end
  530.   #--------------------------------------------------------------------------
  531.   # * Turn 90? Left
  532.   #--------------------------------------------------------------------------
  533.   def turn_left_90
  534.     case @direction
  535.     when 2
  536.       turn_right
  537.     when 4
  538.       turn_down
  539.     when 6
  540.       turn_up
  541.     when 8
  542.       turn_left
  543.     when 1
  544.       turn_upper_right
  545.     when 3
  546.       turn_upper_left
  547.     when 7
  548.       turn_lower_right
  549.     when 9
  550.       turn_lower_left
  551.     end
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # * Turn 180?
  555.   #--------------------------------------------------------------------------
  556.   def turn_180
  557.     case @direction
  558.     when 2
  559.       turn_up
  560.     when 4
  561.       turn_right
  562.     when 6
  563.       turn_left
  564.     when 8
  565.       turn_down
  566.     when 1
  567.       turn_upper_left
  568.     when 3
  569.       turn_lower_left
  570.     when 7
  571.       turn_upper_right
  572.     when 9
  573.       turn_lower_right
  574.     end
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # * Turn 90? Right or Left
  578.   #--------------------------------------------------------------------------
  579.   def turn_right_or_left_90
  580.     if rand(2) == 0
  581.       turn_right_90
  582.     else
  583.       turn_left_90
  584.     end
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # * Turn at Random
  588.   #--------------------------------------------------------------------------
  589.   def turn_random
  590.     case rand(8)
  591.     when 0
  592.       turn_up
  593.     when 1
  594.       turn_right
  595.     when 2
  596.       turn_left
  597.     when 3
  598.       turn_down
  599.     when 4
  600.       turn_lower_left
  601.     when 5
  602.       turn_lower_right
  603.     when 6
  604.       turn_upper_left
  605.     when 7
  606.       turn_upper_right
  607.     end
  608.   end
  609.   #--------------------------------------------------------------------------
  610.   # * Turn 45? Right
  611.   #--------------------------------------------------------------------------
  612.   def turn_right_45
  613.     case @direction
  614.     when 2
  615.       turn_lower_left
  616.     when 4
  617.       turn_upper_left
  618.     when 6
  619.       turn_lower_right
  620.     when 8
  621.       turn_upper_right
  622.     when 1
  623.       turn_left
  624.     when 3
  625.       turn_down
  626.     when 7
  627.       turn_up
  628.     when 9
  629.       turn_right
  630.     end
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # * Turn 45? Left
  634.   #--------------------------------------------------------------------------
  635.   def turn_left_45
  636.     case @direction
  637.     when 2
  638.       turn_lower_right
  639.     when 4
  640.       turn_lower_left
  641.     when 6
  642.       turn_upper_right
  643.     when 8
  644.       turn_upper_left
  645.     when 1
  646.       turn_down
  647.     when 3
  648.       turn_right
  649.     when 7
  650.       turn_left
  651.     when 9
  652.       turn_up
  653.     end
  654.   end
  655.   #--------------------------------------------------------------------------
  656.   # * Turn 45? Right or Left
  657.   #--------------------------------------------------------------------------
  658.   def turn_right_or_left_45
  659.     if rand(2) == 0
  660.       turn_right_45
  661.     else
  662.       turn_left_45
  663.     end
  664.   end
  665.   #--------------------------------------------------------------------------
  666.   # * Turn Forward Right
  667.   #--------------------------------------------------------------------------
  668.   def turn_forward_right
  669.     turn_right_45
  670.     move_forward
  671.   end
  672.   #--------------------------------------------------------------------------
  673.   # * Turn Forward Left
  674.   #--------------------------------------------------------------------------
  675.   def turn_forward_left
  676.     turn_left_45
  677.     move_forward
  678.   end
  679.   #--------------------------------------------------------------------------
  680.   # * Turn Backward Right
  681.   #--------------------------------------------------------------------------
  682.   def turn_backward_right
  683.     turn_right_45
  684.     move_backward
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # * Turn Backward Left
  688.   #--------------------------------------------------------------------------
  689.   def turn_backward_left
  690.     turn_left_45
  691.     move_backward
  692.   end
  693.   #--------------------------------------------------------------------------
  694.   # * Turn Towards Player
  695.   #--------------------------------------------------------------------------
  696.   def turn_toward_player
  697.     # Get difference in player coordinates
  698.     sx = @x - $game_player.x
  699.     sy = @y - $game_player.y
  700.     # If coordinates are equal
  701.     if sx == 0 and sy == 0
  702.       return
  703.     end
  704.     # Get absolute value of difference
  705.     abs_sx = sx.abs
  706.     abs_sy = sy.abs
  707.     #get diagonal differences
  708.     sh = (abs_sx / 2) - abs_sy
  709.     sv = (abs_sy / 2) - abs_sx
  710.     # If the diagonal distance is equal
  711.     if (sh == 0 or sv == 0) &&
  712.        ((abs_sx != 1 and abs_sy != 0) or (abs_sx != 0 and abs_sy != 1))
  713.       return
  714.     end
  715.     # Is the player more towards a 45? angle?
  716.     if abs_sx == abs_sy || (sv < 0 and sh < 0)
  717.       if $game_player.y > @y
  718.         #if the player is lower left
  719.         if $game_player.x < @x
  720.           turn_lower_left
  721.         #If the player is lower right
  722.         else
  723.           turn_lower_right
  724.         end
  725.       else
  726.         #if the player is upper left
  727.         if $game_player.x < @x
  728.           turn_upper_left
  729.         #if the player is upper right
  730.         else
  731.           turn_upper_right
  732.         end
  733.       end
  734.     # If horizontal distance is longer
  735.     elsif abs_sx > abs_sy
  736.       # Turn to the right or left toward player
  737.       sx > 0 ? turn_left : turn_right
  738.     # If vertical distance is longer
  739.     else
  740.       # Turn up or down toward player
  741.       sy > 0 ? turn_up : turn_down
  742.     end
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # * Turn Away from Player
  746.   #--------------------------------------------------------------------------
  747.   def turn_away_from_player
  748.     # Get difference in player coordinates
  749.     sx = @x - $game_player.x
  750.     sy = @y - $game_player.y
  751.     # If coordinates are equal
  752.     if sx == 0 and sy == 0
  753.       return
  754.     end
  755.     # Get absolute value of difference
  756.     abs_sx = sx.abs
  757.     abs_sy = sy.abs
  758.     #get diagonal differences
  759.     sh = (abs_sx / 2) - abs_sy
  760.     sv = (abs_sy / 2) - abs_sx
  761.     # If the diagonal distance is equal
  762.     if (sh == 0 or sv == 0) &&
  763.        ((abs_sx != 1 and abs_sy != 0) or (abs_sx != 0 and abs_sy != 1))
  764.       return
  765.     end
  766.     # Is the player more towards a 45? angle?
  767.     if abs_sx == abs_sy || (sv < 0 and sh < 0)
  768.       if $game_player.y > @y
  769.         #if the player is lower left
  770.         if $game_player.x < @x
  771.           turn_upper_right
  772.         #If the player is lower right
  773.         else
  774.           turn_upper_left
  775.         end
  776.       else
  777.         #if the player is upper left
  778.         if $game_player.x < @x
  779.           turn_lower_right
  780.         #if the player is upper right
  781.         else
  782.           turn_lower_left
  783.         end
  784.       end
  785.     # If horizontal distance is longer
  786.     elsif abs_sx > abs_sy
  787.       # Turn to the right or left away from player
  788.       sx > 0 ? turn_right : turn_left
  789.     # If vertical distance is longer
  790.     else
  791.       # Turn up or down away from player
  792.       sy > 0 ? turn_down : turn_up
  793.     end
  794.   end
  795. end
  796.  
  797. #-----------------------------------------------------------------------------
  798. # * Game Player
  799. #-----------------------------------------------------------------------------
  800. class Game_Player < Game_Character
  801.   #--------------------------------------------------------------------------
  802.   # * SDK Log Overwritten and Aliased Methods
  803.   #--------------------------------------------------------------------------
  804.   SDK.log_overwrite(:Game_Player, :check_event_trigger_there)
  805.   alias_method(:advanced_8d_movement_game_player_update_player_movement,
  806.                :update_player_movement)
  807.   #--------------------------------------------------------------------------
  808.   # * Front Event Starting Determinant
  809.   #--------------------------------------------------------------------------
  810.   def check_event_trigger_there(triggers)
  811.     result = false
  812.     # If event is running
  813.     if $game_system.map_interpreter.running?
  814.       return result
  815.     end
  816.     # Calculate front event coordinates
  817.     new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 :
  818.                   @direction == 1 ? -1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
  819.                   @direction == 9 ? +1 : 0)
  820.     new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 :
  821.                   @direction == 1 ? +1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
  822.                   @direction == 9 ? -1 : 0)
  823.     # All event loops
  824.     for event in $game_map.events.values
  825.       # If event coordinates and triggers are consistent
  826.       if event.x == new_x and event.y == new_y and
  827.          triggers.include?(event.trigger)
  828.         # If starting determinant is front event (other than jumping)
  829.         if not event.jumping? and not event.over_trigger?
  830.           event.start
  831.           result = true
  832.         end
  833.       end
  834.     end
  835.     # If fitting event is not found
  836.     if result == false
  837.       # If front tile is a counter
  838.       if $game_map.counter?(new_x, new_y)
  839.         # Calculate 1 tile inside coordinates
  840.         new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 :
  841.                   @direction == 1 ? -1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
  842.                   @direction == 9 ? +1 : 0)
  843.         new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 :
  844.                   @direction == 1 ? +1 : @direction == 3 ? +1 : @direction == 7 ? -1 :
  845.                   @direction == 9 ? -1 : 0)
  846.         # All event loops
  847.         for event in $game_map.events.values
  848.           # If event coordinates and triggers are consistent
  849.           if event.x == new_x and event.y == new_y and
  850.              triggers.include?(event.trigger)
  851.             # If starting determinant is front event (other than jumping)
  852.             if not event.jumping? and not event.over_trigger?
  853.               event.start
  854.               result = true
  855.             end
  856.           end
  857.         end
  858.       end
  859.     end
  860.     return result
  861.   end
  862.   #--------------------------------------------------------------------------
  863.   # * Frame Update : Player Movement
  864.   #--------------------------------------------------------------------------
  865.   def update_player_movement
  866.     #if none of the movement input types are toggled
  867.     unless $game_system.default_movement || $game_system.mouse_movement ||
  868.            $game_system.axial_movement || $game_system.numpad_movement ||
  869.       #use the standard four directional movement
  870.       advanced_8d_movement_game_player_update_player_movement
  871.     end
  872.     # Turn player using left/right and forward/backward using up/down
  873.     if $game_system.axial_movement
  874.       case Input.axial_dir8
  875.       when 1
  876.         turn_backward_right
  877.       when 2
  878.         move_backward
  879.       when 3
  880.         turn_backward_left
  881.       when 4
  882.         turn_left_45
  883.         $game_system.wait = 5
  884.       when 6
  885.         turn_right_45
  886.         $game_system.wait = 5
  887.       when 7
  888.         turn_forward_left
  889.       when 8
  890.         move_forward
  891.       when 9
  892.         turn_forward_right
  893.       end
  894.     #Use the default 8-directional movement method
  895.     elsif $game_system.default_movement
  896.       case Input.dir8
  897.       when 2
  898.         move_down
  899.       when 4
  900.         move_left
  901.       when 6
  902.         move_right
  903.       when 8
  904.         move_up
  905.       when 1
  906.         move_lower_left
  907.       when 3
  908.         move_lower_right
  909.       when 7
  910.         move_upper_left
  911.       when 9
  912.         move_upper_right
  913.       end
  914.     end
  915.     # Move player using the Mouse
  916.     if $game_system.mouse_movement
  917.       if Input.press?(Keys::MOUSE_LEFT)
  918.         unless Mouse.pos == nil
  919.           if Mouse.pos[0].between?(-1, 640) && Mouse.pos[1].between?(-1, 480)
  920.             x =  Mouse.grid[0]
  921.             y =  Mouse.grid[1]
  922.             # checks to see if an event occupies the map tile
  923.             while $game_map.check_event(x,y).is_a?(Numeric)
  924.               return #does nothing | can edit this later to do something else
  925.             end
  926.             $game_player.find_path(x,y) # moves the player if there is no event
  927.           end
  928.         end
  929.       end
  930.     end
  931.     # Move player using the numpad
  932.     if $game_system.numpad_movement
  933.       if Input.press?(Keys::NUMPAD1)
  934.         move_lower_left
  935.       end
  936.       if Input.press?(Keys::NUMPAD2)
  937.         move_down
  938.       end
  939.       if Input.press?(Keys::NUMPAD3)
  940.         move_lower_right
  941.       end
  942.       if Input.press?(Keys::NUMPAD4)
  943.         move_left
  944.       end
  945.       if Input.press?(Keys::NUMPAD6)
  946.         move_right
  947.       end
  948.       if Input.press?(Keys::NUMPAD7)
  949.         move_upper_left
  950.       end
  951.       if Input.press?(Keys::NUMPAD8)
  952.         move_up
  953.       end
  954.       if Input.press?(Keys::NUMPAD9)
  955.         move_upper_right
  956.       end
  957.     end
  958.   end
  959. end
  960.  
  961. #-----------------------------------------------------------------------------
  962. # * Sprite Character
  963. #-----------------------------------------------------------------------------
  964. class Sprite_Character < RPG::Sprite
  965.   SDK.log_overwrite(:Sprite_Character, :update)
  966.   def update
  967.     super
  968.     # If tile ID, file name, or hue are different from current ones
  969.     if @tile_id != @character.tile_id or
  970.        @character_name != @character.character_name or
  971.        @character_hue != @character.character_hue
  972.       # Remember tile ID, file name, and hue
  973.       @tile_id = @character.tile_id
  974.       @character_name = @character.character_name
  975.       @character_hue = @character.character_hue
  976.       # If tile ID value is valid
  977.       if @tile_id >= 384
  978.         self.bitmap = RPG::Cache.tile($game_map.tileset_name,
  979.                                       @tile_id, @character.character_hue)
  980.         self.src_rect.set(0, 0, 32, 32)
  981.         self.ox = 16
  982.         self.oy = 32
  983.       # If tile ID value is invalid
  984.       else
  985.         self.bitmap = RPG::Cache.character(@character.character_name,
  986.                                            @character.character_hue)
  987.         @cw = bitmap.width / 4
  988.         @ch = bitmap.height / 8
  989.         self.ox = @cw / 2
  990.         self.oy = @ch
  991.       end
  992.     end
  993.     # Set visible situation
  994.     self.visible = (not @character.transparent)
  995.     # If graphic is character
  996.     if @tile_id == 0
  997.       # Set rectangular transfer
  998.       sx = @character.pattern * @cw
  999.       if @character.direction >= 6
  1000.         sy = (@character.direction - 2 ) * @ch
  1001.       else
  1002.         sy = (@character.direction - 1 ) * @ch
  1003.       end
  1004.       self.src_rect.set(sx, sy, @cw, @ch)
  1005.     end
  1006.     # Set sprite coordinates
  1007.     self.x = @character.screen_x
  1008.     self.y = @character.screen_y
  1009.     self.z = @character.screen_z(@ch)
  1010.     # Set opacity level, blend method, and bush depth
  1011.     self.opacity = @character.opacity
  1012.     self.blend_type = @character.blend_type
  1013.     self.bush_depth = @character.bush_depth
  1014.     # Animation
  1015.     if @character.animation_id != 0
  1016.       animation = $data_animations[@character.animation_id]
  1017.       animation(animation, true)
  1018.       @character.animation_id = 0
  1019.     end
  1020.   end
  1021. end
  1022.  
  1023. #-----------------------------------------------------------------------------
  1024. # * Scene Map
  1025. #-----------------------------------------------------------------------------
  1026. class Scene_Map
  1027.   alias_method (:advanced_8d_movement_scene_map_update, :update)
  1028.   def update
  1029.     if $game_system.wait > 0
  1030.       $game_system.wait -= 1
  1031.       return
  1032.     end
  1033.     advanced_8d_movement_scene_map_update
  1034.   end
  1035. end
  1036.  
  1037. #-----------------------------------------------------------------------------
  1038. # * Window Base
  1039. #-----------------------------------------------------------------------------
  1040. class Window_Base
  1041.   #--------------------------------------------------------------------------
  1042.   # * Draw Graphic
  1043.   #     actor : actor
  1044.   #     x     : draw spot x-coordinate
  1045.   #     y     : draw spot y-coordinate
  1046.   #--------------------------------------------------------------------------
  1047.   def draw_actor_graphic(actor, x, y)
  1048.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  1049.     cw = bitmap.width / 4
  1050.     ch = bitmap.height / 8
  1051.     #set which direction to draw(draws down by default)
  1052.     dir = 2
  1053.     #interprets direction to frame
  1054.     if dir >= 6
  1055.       sy = (dir - 2 ) * ch
  1056.     else
  1057.       sy = (dir - 1 ) * ch
  1058.     end
  1059.     #draws the actor
  1060.     src_rect = Rect.new(0, sy, cw, ch)
  1061.     self.contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
  1062.   end
  1063. end
  1064.  
  1065. #-----------------------------------------------------------------------------
  1066. # * Window SaveFile
  1067. #-----------------------------------------------------------------------------
  1068. class Window_SaveFile < Window_Base
  1069.   #--------------------------------------------------------------------------
  1070.   # * Refresh
  1071.   #--------------------------------------------------------------------------
  1072.   def refresh
  1073.     self.contents.clear
  1074.     # Draw file number
  1075.     self.contents.font.color = normal_color
  1076.     name = "File#{@file_index + 1}"
  1077.     self.contents.draw_text(4, 0, 600, 32, name)
  1078.     @name_width = contents.text_size(name).width
  1079.     # If save file exists
  1080.     if @file_exist
  1081.       # Draw character
  1082.       for i in [email hidden]
  1083.         bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
  1084.         cw = bitmap.rect.width / 4
  1085.         ch = bitmap.rect.height / 8
  1086.         #set which direction to draw(draws down by default)
  1087.         dir = 2
  1088.         #interprets direction to frame
  1089.         if dir >= 6
  1090.           sy = (dir - 2 ) * ch
  1091.         else
  1092.           sy = (dir - 1 ) * ch
  1093.         end
  1094.         src_rect = Rect.new(0, sy, cw, ch)
  1095.         x = 300 - @characters.size * 32 + i * 64 - cw / 2
  1096.         self.contents.blt(x, 68 - ch, bitmap, src_rect)
  1097.       end
  1098.       # Draw play time
  1099.       hour = @total_sec / 60 / 60
  1100.       min = @total_sec / 60 % 60
  1101.       sec = @total_sec % 60
  1102.       time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
  1103.       self.contents.font.color = normal_color
  1104.       self.contents.draw_text(4, 8, 600, 32, time_string, 2)
  1105.       # Draw timestamp
  1106.       self.contents.font.color = normal_color
  1107.       time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
  1108.       self.contents.draw_text(4, 40, 600, 32, time_string, 2)
  1109.     end
  1110.   end
  1111. end
  1112.  
  1113. #-----------------------------------------------------------------------------
  1114. # * End SDK Enable Test
  1115. #-----------------------------------------------------------------------------
  1116. end
Expand to see the code.


Instructions

To toggle the various methods of movement, use the following call scripts:
Default 8-directional movement : $game_system.default_movement = true
Point and Click movement : $game_system.mouse_movement = true
Axial Movement : $game_system.axial_movement = true
Numpad Movement : $game_system.numpad_movement = true

If you want to use only 4-directional movement, then set all the previous metioned variables to false.
You will also need new character spritesheets with all eight directions. here is the one used in the demo:

Image


Compatibility

No known compatablity issues as of yet, though three other scripts are required. They can be found within the demo.
(Note: Near's Pathfinding Script in the demo has been modified by me. The modified version is what is required.)

This script will not work with 4 directional sprites. The following spoiler will contain links to templates, and/or sprites that will work with this system. If you know of any others, feel free to post a link here and I will add it to the list.
8-Directional Templates Show
BREEZE 8-Directional Template by Lei (based on the original Breeze template by GreenRaven)


Credits and Thanks

Thanks to Near_Fantastica for his pathfinding script and superior mouse module. Also thanks to vgvgf(Aleworks) for his input module which made editing the input module for axial movement much easier. And to the SDK team.

Author's Notes

Changes made in version 3.01:
  • Axial movement can now turn while moving
  • Improved event movement toward and away from player
  • Uses Aleworks Input Module instead of Near's Keyboard
  • fixes clash between axial and default or numpad movement
  • fixed bug with turn toward/away from player
  • fixed draw_actor bug in menus
  • can now jump in eight directions
  • fixed draw_actor bug in the save and load menus.
Version 3.20 will feature a faster, more versatile, bug free pathfinding script. Keep an eye out, it will be coming soon. It will also no longer require any of Near's scripts, but that is to come at a later date.

If you find any bugs, or have any suggestions, feel free to leave your comments.
nice script but it's giving me errors
Uhh wow another scripter actually uploaded a demo to the Download Manager :)

Wow pretty need but I don't agree with your use of global variables they would have been better suited as an instance variable of game system (if you do this then your edits to the Save and Load Scenes are not needed as Game_System is saved with the save data)

also if you need any help converting this to be SDK compliant then get in touch with me and I'll help, because in this scripts current state it is overwriting a few of the methods SDK splits up which is not good
@ chaos_prime: What type of errors? Do you have the other scripts by Near_Fantastica that are needed?

@Trickster: Thank you. I'm still new and trying to learn. your help would be appreciated. I'll send a PM in your direction shortly.
I have made the script SDK 2.2 compliant. See the first post.
Dont you think the spritesheet is too small... The spritesheet is smaller then the default sprite (001-hero001)....Can you edit it and let it become bigger sprite?

And I found out a few bug! When press start and see the hero status....The sprite is 2 rock ball...I mean this:http://img185.imageshack.us/img185/8322/untitledkp8.png[/IMG]

The second bug is: When I talk with the event isometricly...The event won't turn towards player...
Another Bug with the Axil movement, you can not move down, and when you go to turn you slide to the side.
@OmegaGrouden: I edited the rock02 charactersprite. I left it the same size as it was, just added arrows so you can see which direction it faced. I did notice that first bug you pointed out, It just didn't occur to me. I will look into it deeper and fix it. As for the second bug, I realized that after I had "finished" it, and if you look at the first post, it is already included in the list of things to do. turn_towards_player

@Neonyo: Make sure, when you turn on axial movement, you turn off default movement.

$game_system.default_movement = false[/FONT]

That should fix it.
I mean the rockball too small per movement...You know wat I mean? My character this bigger than the size of rockball...

Can you make it support this kind of spritesheet?
Take a look!
http://img133.imageshack.us/img133/7831 ... e01mh7.png[/img]
oh, I see. In that case, near the end of my script, in the Sprite_Character class just before Game_Map, find this bit of code:
        @cw = bitmap.width / 4
        @ch = bitmap.height / 8
        self.ox = @cw / 2
        self.oy = @ch
Expand to see the code.


@cw defines how many frames per pose. change the 4 to 9. you may also have to change
self.ox = @cw / 2
but since I'm not at home right now, I can't tell you what it would need to be changed to. I won't be able to do anything to the script itself until Tuesday.

EDIT: I noticed you have a standing pose at the begining and 8 frame walking poses. Doing it the way I just said will probably include the standing frame along with the walking frames. I will look into a way to have the script use the standing frame when standing and loop frames 2-9 when walking, since that is probably what you want. It will take me some time, since i only get about one to three hours on the computer at home during the weekdays, and work all day on the weekends. Plus, my son has a doctor's appointment on Monday, so i won't be able to get on the home computer until Tuesday. I'll let you know what i can find.
Thanks, but for the self.ox could you explain wat is the function? I can't wait till Tuesday... I need as fast as I could....
I don't know. I don't have rmxp at work and won't be able to look into it until Tuesday. Try to edit it the way I said for now, see what happens, then fiddle with that number at the end of self.ox and see what happens until you find the right one for your purpose. That's the best i can offer right now.
There is an update. The following methods were redefined:
  • Move toward player
  • Move Away from player
  • Turn toward player
  • Turn away from player
  • Jump
The bug where two frames of the actor graphic would be drawn in the menus has been fixed.

If you find any other bugs or have suggestions for improvement, leave your comments here. As far as I'm concerned, this script is at it's final version, unless there are bugfixes in the future.

If you want more than four frame animation, I suggest using another script as this one is designed for only four frames of animation.
DraycosGoldaryn;196276 wrote:
As far as I'm concerned, this script is at it's final version, unless there are bugfixes in the future.


I lied... Introducing Version 3.00!!

Axial movement has improved, a few other bugs were fixed, and aleworks input module has replaced near's keyboard module (this allowed better editing of the input module to do allow numpad movement to work with axial movement.).

As always, if you have any suggestions or questions or if you find any bugs, post it here.

Thank you.
Found a bug and fixed it. Silly me, when I fixed the menu bug, I didn't notice that the Window_SaveFile was not affected... now it's fixed as well.
Very cool script. Do you think this would be compatible with this ABS I'm planning on using?

http://www.phanxgames.com/resources/displayimage.php?album=52&pos=0

I know it's a long shot, but if it's possible, I'd like to implement this ABS with 8 directional movement (with proper anims of course) and the ability to attack and shoot projectiles diagonally?

4 way movement seems a bit restrictive for this kind of thing.
Uh oh, my comp freaked and I ended up double posting trying to save it. Sorry.
Hey draycos! I had a small request, and I hope someone thinks this is a good idea... It's about dashing. Your script works wonders for me, and I love it to death. Sure, I do not need the point and click thingy, and a couple few more things, but besides that, your script is awsome. There is one thing though, that I still need... spritesheet changing for the dash. What I mean is, could you implement a function in your script, that given I press X key for the dash, the charset will change to a dashing charset? Something like

if 'x' is pressed then
charset.sprite=charset.sprite+"_dash"

I know this is not programming language, it's just the idea for the thing. I'm still quite n00bish when it comes to RGSS. I'm learning, but I still have a long way to go.
Of course, this could be another of those functions we could activate / deactivate when moving towards the end of your script. And perhaps, for just those who want to change the charset, you could also implement a choice in the script for us to choose if this function would be applied to the dashing function, or simply changing the charset... I think you get what I mean, right?

If you could do this, you would so much be my hero!
Heyyy, resident evil style movement! Coooooool.

Except, I can't see how axial movement would be really useful without prerendered backgrounds or sudden camera changes.
Guys, please, make an effort of looking at the last post's date. And when you do, and realize it's been sent long time ago - find another topic to post :]

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=15551