Save-Point
new 8dir movement add-on - Printable Version

+- Save-Point (https://www.save-point.org)
+-- Forum: Archives (https://www.save-point.org/forum-105.html)
+--- Forum: Creation Asylum Archives (https://www.save-point.org/forum-90.html)
+---- Forum: Scripts & Code Snippets (https://www.save-point.org/forum-92.html)
+----- Forum: RPG Maker XP Code (https://www.save-point.org/forum-93.html)
+----- Thread: new 8dir movement add-on (/thread-6754.html)



new 8dir movement add-on - Aoshiwik - 03-02-2005

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Hi I don't know if you remember me but i posted here 2 times a while ago. I then lost interest in rpg maker xp, but now i think my interest is back. after browsing the forum looking at the recent developments, I saw dubealex made a 8dir add-on, but he was calling move left, right, down up twice when you were moving that direction, that is the reason random battles did not occur when set to 1 step.

The script below alias's the 4 move methods Game_Player update calls and then checks for 8 dir movement.

Code:
class Game_Player    
alias_method :old_move_down_8dir, :move_down
   alias_method :old_move_up_8dir, :move_up
    alias_method :old_move_left_8dir, :move_left
  alias_method :old_move_right_8dir, :move_right
    
  def directionalMovement8
    case Input.dir8
    when 2 then old_move_down_8dir
    when 4 then old_move_left_8dir
    when 6 then old_move_right_8dir
    when 8 then old_move_up_8dir
    when 7 then move_upper_left
    when 9 then move_upper_right
    when 3 then move_lower_right
    when 1 then move_lower_left
    end
  end
  
  def move_down(*args)
    directionalMovement8
  end
  
  def move_left(*args)
    directionalMovement8
  end
  
  def move_right(*args)
    directionalMovement8
  end
  
  def move_up(*args)
    directionalMovement8
  end
end