Here is what I use for 8-direction based movement for events:
#-----------------------------------------------------------------------
class Game_Character
def move_random
case rand(8)
when 0
move_down(false)
when 1
move_lower_left
when 2
move_left(false)
when 3
move_lower_right
when 4
move_right(false)
when 5
move_upper_left
when 6
move_up(false)
when 7
move_upper_right
end
end
#--------------------------------------------------------------------------
def move_toward_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
if not moving? and sy != 0
sx > 0 ? sy > 0 ? move_upper_left : move_lower_left : sy > 0 ? move_upper_right : move_lower_right
return
end
sx > 0 ? move_left : move_right
if not moving? and sy != 0
sy > 0 ? move_up : move_down
end
else
if not moving? and sx != 0
sx > 0 ? sy > 0 ? move_upper_left : move_lower_left : sy > 0 ? move_upper_right : move_lower_right
return
end
sy > 0 ? move_up : move_down
if not moving? and sx != 0
sx > 0 ? move_left : move_right
end
end
end
#--------------------------------------------------------------------------
def move_away_from_player
sx = @x - $game_player.x
sy = @y - $game_player.y
if sx == 0 and sy == 0
return
end
abs_sx = sx.abs
abs_sy = sy.abs
if abs_sx == abs_sy
rand(2) == 0 ? abs_sx += 1 : abs_sy += 1
end
if abs_sx > abs_sy
if not moving? and sy != 0
sx > 0 ? sy > 0 ? move_lower_left : move_upper_left : sy > 0 ? move_lower_right : move_upper_right
return
end
sx > 0 ? move_right : move_left
if not moving? and sy != 0
sy > 0 ? move_down : move_up
end
else
if not moving? and sy != 0
sx > 0 ? sy > 0 ? move_lower_right : move_upper_right : sy > 0 ? move_lower_left : move_upper_left
return
end
sy > 0 ? move_down : move_up
if not moving? and sx != 0
sx > 0 ? move_right : move_left
end
end
end
end
############################################################
#EDIT-------------------------------------------------------------------------------#
############################################################
http://forum.chaos-project.com/index...pic=555.0;wap2
Try this. You will have to tweak it a bit and the section 8a will take a little reading to replace. Also you will have to edit your sprites to work with the 8 directional movement. Hope this helps.