Hi guys
I have some problems with a amended script.
I explain you in picture :
(http://i68.servimg.com/u/f68/17/98/61/70/00010.png)
*Red line : Isometric move.
*Green line : Diagonal move.
As you can see, the script handles very well in isometric.
But now, diagonal move is sacrificed for iso movements.
I wan't to know if someone can help me with this.
Can you add diagonal movements with an activation condition ?
Exemple... if switch [0001] is on, diagonal movements is enable. (Green line)
If switch [0001] if off, we let isometric movements. (Red line)
#---------------------------------------------------------------------------------
# SUPER WALK 1.2b + Déplacements isométriques
#---------------------------------------------------------------------------------
# Script créé par Zeus81
# Modifiée par Kreiss
#---------------------------------------------------------------------------------
class Game_Player
SUPER_WALK_SWITCH = 130 # id de l'interrupteur pour activer/désactiver le script
end
class Game_Character
alias super_walk_game_character_initialize initialize
def initialize
@x2 = @y2 = 0
super_walk_game_character_initialize
end
def super_walk_distance
@move_speed > 4 ? @move_speed > 5 ? 0.5 : 0.25 : 0.125
end
def moving?
@real_x != @x2*128 or @real_y != @y2*128
end
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return false unless $game_map.valid?(new_x, new_y)
return true if @through
return false unless $game_map.passable?(x, y, d, self)
return false unless $game_map.passable?(new_x, new_y, 10-d)
$game_map.events.each_value do |event|
return false if event.x == new_x and event.y == new_y and !event.through and
(self != $game_player or !event.character_name.empty?)
end
return false if $game_player.x == new_x and $game_player.y == new_y and
!$game_player.through and !@character_name.empty?
return true
end
def moveto(x, y)
@x = @x2 = x % $game_map.width
@y = @y2 = y % $game_map.height
@real_x = @x * 128
@real_y = @y * 128
@prelock_direction = 0
end
def update_jump
@jump_count -= 1
@real_x = (@real_x * @jump_count + @x2 * 128) / (@jump_count + 1)
@real_y = (@real_y * @jump_count + @y2 * 128) / (@jump_count + 1)
end
def update_move
x128, y128, distance = @x2*128, @y2*128, 2**@move_speed
if x128 < @real_x; @real_x = [@real_x-distance*2, x128].max
elsif x128 > @real_x; @real_x = [@real_x+distance*2, x128].min
end
if y128 < @real_y; @real_y = [@real_y-distance, y128].max
elsif y128 > @real_y; @real_y = [@real_y+distance, y128].min
end
if @walk_anime; @anime_count += 1.5
elsif @step_anime; @anime_count += 1
end
end
def move_down(turn_enabled=true, super_walk=false)
turn_down if turn_enabled
if passable?(@x, @y, 2)
turn_down
if super_walk
@x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y, 2)
@x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y, 2)
@y2 += super_walk_distance
@y = @y2.round
else @y2 = @y += 1
end
increase_steps
elsif @y2 < @y
@y2 += 0.125
else
check_event_trigger_touch(@x, @y+1)
return false
end
return true
end
def move_left(turn_enabled=true, super_walk=false)
turn_left if turn_enabled
if passable?(@x, @y, 4)
turn_left
if super_walk
@y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 4)
@y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 4)
@x2 -= super_walk_distance
@x = @x2.round
else @x2 = @x -= 1
end
increase_steps
elsif @x2 > @x
@x2 -= 0.125
else
check_event_trigger_touch(@x-1, @y)
return false
end
return true
end
def move_right(turn_enabled=true, super_walk=false)
turn_right if turn_enabled
if passable?(@x, @y, 6)
turn_right
if super_walk
@y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 6)
@y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 6)
@x2 += super_walk_distance
@x = @x2.round
else @x2 = @x += 1
end
increase_steps
elsif @x2 < @x
@x2 += 0.125
else
check_event_trigger_touch(@x+1, @y)
return false
end
return true
end
def move_up(turn_enabled=true, super_walk=false)
turn_up if turn_enabled
if passable?(@x, @y,
turn_up
if super_walk
@x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y,
@x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y,
@y2 -= super_walk_distance
@y = @y2.round
else @y2 = @y -= 1
end
increase_steps
elsif @y2 > @y
@y2 -= 0.125
else
check_event_trigger_touch(@x, @y-1)
return false
end
return true
end
#--------------------------------------------------------------------------
# Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_down(false, super_walk)
move2 = move_left(false, super_walk)
move_left(false, super_walk)
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 6 ? 4 : last_dir == 8 ? 2 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
# Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_down( false, super_walk)
move2 = move_right(false, super_walk)
move_right(false, super_walk)
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 4 ? 6 : last_dir == 8 ? 2 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
# Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_up( false, super_walk)
move2 = move_left(false, super_walk)
move_left(false, super_walk)
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 6 ? 4 : last_dir == 2 ? 8 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
# Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_up( false, super_walk)
move2 = move_right(false, super_walk)
move_right(false, super_walk)
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 4 ? 6 : last_dir == 2 ? 8 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
def move_random
case rand(8)
when 0; move_lower_left
when 1; move_down
when 2; move_lower_right
when 3; move_left
when 4; move_upper_left
when 5; move_right
when 6; move_upper_right
when 7; move_up
end
end
def jump(x_plus, y_plus)
loop do
if (x_plus == 0 and y_plus == 0) or passable?(@x+x_plus, @y+y_plus, 0)
if x_plus.abs > y_plus.abs
x_plus < 0 ? turn_left : turn_right
else y_plus < 0 ? turn_up : turn_down
end unless x_plus == 0 and y_plus == 0
straighten
@x += x_plus
@x2 += x_plus
@y += y_plus
@y2 += y_plus
@jump_peak = 10 - @move_speed + Math.hypot(x_plus, y_plus).round
@jump_count = @jump_peak * 2
@stop_count = 0
return
end
x_plus -= 1 if x_plus > 0
x_plus += 1 if x_plus < 0
y_plus -= 1 if y_plus > 0
y_plus += 1 if y_plus < 0
end
end
end
class Game_Player
def update
last_x, last_y, last_rx, last_ry = @x, @y, @real_x, @real_y
super_walk = $game_switches[SUPER_WALK_SWITCH]
unless last_moving = moving? or @move_route_forcing or
$game_temp.message_window_showing or
$game_system.map_interpreter.running?
case Input.dir8
when 1; move_lower_left( true, super_walk)
when 2; move_down( true, super_walk)
when 3; move_lower_right(true, super_walk)
when 4; move_left( true, super_walk)
when 6; move_right( true, super_walk)
when 7; move_upper_left( true, super_walk)
when 8; move_up( true, super_walk)
when 9; move_upper_right(true, super_walk)
end
end
last_moving = last_x != @x || last_y != @y if super_walk
super
$game_map.scroll_left(last_rx-@real_x) if @real_x < last_rx and @real_x-$game_map.display_x < CENTER_X
$game_map.scroll_right(@real_x-last_rx) if @real_x > last_rx and @real_x-$game_map.display_x > CENTER_X
$game_map.scroll_up(last_ry-@real_y) if @real_y < last_ry and @real_y-$game_map.display_y < CENTER_Y
$game_map.scroll_down(@real_y-last_ry) if @real_y > last_ry and @real_y-$game_map.display_y > CENTER_Y
unless moving?
if last_moving and !check_event_trigger_here([1,2])
if @encounter_count > 0 and !($DEBUG and Input.press?(Input::CTRL))
@encounter_count -= 1
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
It would help the project to have more fluid movements.
Thanks a lot !
PS : Switch 130 is for pixel movements.
The only thing I can think is some sort of height parameter and slopes. Not sure if that script can handle slopes. When you can define slopes, then calculations should automatically take that into account and also be able to handle the Y offset when standing on higher ground. Try to check the script if it supports something like that.
I've watched already, but nothing something like that...
It's not possible to mix with an another script ?
here, this is the original script with diagonals moves. (Not iso)
#########################
# SUPER WALK #
#Script créé par Zeus81#
#########################
class Game_Character
attr_reader :x2
attr_reader :y2
alias game_character_initialize initialize
def initialize
@x2 = 0
@y2 = 0
game_character_initialize
end
def moving?
return (@real_x != @x2 * 128 or @real_y != @y2 * 128)
end
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
unless $game_map.valid?(new_x, new_y)
return false
end
if @through
return true
end
unless $game_map.passable?(x, y, d, self)
return false
end
unless $game_map.passable?(new_x, new_y, 10 - d)
return false
end
for event in $game_map.events.values
if event.x == new_x and event.y == new_y
unless event.through
if event.character_name != ""
return false
end
end
end
end
if $game_player.x == new_x and $game_player.y == new_y
unless $game_player.through
if @character_name != ""
return false
end
end
end
return true
end
def moveto(x, y)
@x = @x2 = x % $game_map.width
@y = @y2 = y % $game_map.height
@real_x = @x * 128
@real_y = @y * 128
@prelock_direction = 0
end
def update_jump
@jump_count -= 1
@real_x = (@real_x * @jump_count + @x2 * 128) / (@jump_count + 1)
@real_y = (@real_y * @jump_count + @y2 * 128) / (@jump_count + 1)
end
def update_move
distance = 2 ** @move_speed
if @y2 * 128 > @real_y
@real_y = [@real_y + distance, @y2 * 128].min
end
if @x2 * 128 < @real_x
@real_x = [@real_x - distance, @x2 * 128].max
end
if @x2 * 128 > @real_x
@real_x = [@real_x + distance, @x2 * 128].min
end
if @y2 * 128 < @real_y
@real_y = [@real_y - distance, @y2 * 128].max
end
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
def move_down(turn_enabled = true, player = false)
turn_down if turn_enabled
if passable?(@x, @y, 2)
if player
@x2 -= 0.125 if passable?(@x+1, @y, 2) == false and @x2 > @x
@x2 += 0.125 if passable?(@x-1, @y, 2) == false and @x2 < @x
multiplicateur = [(@move_speed - 4) * 2, 1].max
@y2 += 0.125 * multiplicateur
else
@y2 += 1
end
@y = @y2.round
increase_steps
else
if @y2 < @y
@y2 += 0.0625
else
check_event_trigger_touch(@x, @y+1)
end
end
end
def move_left(turn_enabled = true, player = false)
turn_left if turn_enabled
if passable?(@x, @y, 4)
if player
@y2 -= 0.125 if passable?(@x, @y+2, 4) == false and @y2 > @y
@y2 += 0.125 if passable?(@x, @y-2, 4) == false and @y2 < @y
multiplicateur = [(@move_speed - 4) * 2, 1].max
@x2 -= 0.125 * multiplicateur
else
@x2 -= 1
end
@x = @x2.round
increase_steps
else
if @x2 > @x
@x2 -= 0.0625
else
check_event_trigger_touch(@x-1, @y)
end
end
end
def move_right(turn_enabled = true, player = false)
turn_right if turn_enabled
if passable?(@x, @y, 6)
if player
@y2 -= 0.125 if passable?(@x, @y+1, 6) == false and @y2 > @y
@y2 += 0.125 if passable?(@x, @y-1, 6) == false and @y2 < @y
multiplicateur = [(@move_speed - 4) * 2, 1].max
@x2 += 0.125 * multiplicateur
else
@x2 += 1
end
@x = @x2.round
increase_steps
else
if @x2 < @x
@x2 += 0.0625
else
check_event_trigger_touch(@x+1, @y)
end
end
end
def move_up(turn_enabled = true, player = false)
turn_up if turn_enabled
if passable?(@x, @y, 8)
if player
@x2 -= 0.125 if passable?(@x+1, @y, 8) == false and @x2 > @x
@x2 += 0.125 if passable?(@x-1, @y, 8) == false and @x2 < @x
multiplicateur = [(@move_speed - 4) * 2, 1].max
@y2 -= 0.125 * multiplicateur
else
@y2 -= 1
end
@y = @y2.round
increase_steps
else
if @y2 > @y
@y2 -= 0.0625
else
check_event_trigger_touch(@x, @y-1)
end
end
end
def move_lower_left(turn_enabled = true, player = false)
turn_lower_left if turn_enabled
move_down(false, player)
move_left(false, player)
end
def move_lower_right(turn_enabled = true, player = false)
turn_lower_right if turn_enabled
move_down(false, player)
move_right(false, player)
end
def move_upper_left(turn_enabled = true, player = false)
turn_upper_left if turn_enabled
move_up(false, player)
move_left(false, player)
end
def move_upper_right(turn_enabled = true, player = false)
turn_upper_right if turn_enabled
move_up(false, player)
move_right(false, player)
end
def move_random
case rand(8)
when 0
move_lower_left
when 1
move_down
when 2
move_lower_right
when 3
move_left
when 4
move_upper_left
when 5
move_right
when 6
move_upper_right
when 7
move_up
end
end
def jump(x_plus, y_plus)
if x_plus != 0 or y_plus != 0
if x_plus.abs > y_plus.abs
x_plus < 0 ? turn_left : turn_right
else
y_plus < 0 ? turn_up : turn_down
end
end
loop do
new_x = @x + x_plus
new_y = @y + y_plus
if (x_plus == 0 and y_plus == 0) or passable?(new_x, new_y, 0)
straighten
@x += x_plus
@x2 += x_plus
@y += y_plus
@y2 += y_plus
distance = Math.sqrt(x_plus * x_plus + y_plus * y_plus).round
@jump_peak = 10 + distance - @move_speed
@jump_count = @jump_peak * 2
@stop_count = 0
return
end
x_plus -= 1 if x_plus > 0
x_plus += 1 if x_plus < 0
y_plus -= 1 if y_plus > 0
y_plus += 1 if y_plus < 0
end
end
def turn_lower_left
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 8 ? 2 : @direction)
@stop_count = 0
end
end
def turn_lower_right
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 8 ? 2 : @direction)
@stop_count = 0
end
end
def turn_upper_left
unless @direction_fix
@direction = (@direction == 6 ? 4 : @direction == 2 ? 8 : @direction)
@stop_count = 0
end
end
def turn_upper_right
unless @direction_fix
@direction = (@direction == 4 ? 6 : @direction == 2 ? 8 : @direction)
@stop_count = 0
end
end
end
class Game_Player < Game_Character
def update
last_x = @x
last_y = @y
unless moving? or $game_system.map_interpreter.running? or
@move_route_forcing or $game_temp.message_window_showing
case Input.dir8
when 1
move_lower_left(true, true)
when 2
move_down(true, true)
when 3
move_lower_right(true, true)
when 4
move_left(true, true)
when 6
move_right(true, true)
when 7
move_upper_left(true, true)
when 8
move_up(true, true)
when 9
move_upper_right(true, true)
end
end
last_moving = (last_x != @x or last_y != @y)
last_real_x = @real_x
last_real_y = @real_y
super
if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
$game_map.scroll_down(@real_y - last_real_y)
end
if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
$game_map.scroll_left(last_real_x - @real_x)
end
if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
$game_map.scroll_right(@real_x - last_real_x)
end
if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
$game_map.scroll_up(last_real_y - @real_y)
end
unless moving?
if last_moving
result = check_event_trigger_here([1,2])
if result == false
unless $DEBUG and Input.press?(Input::CTRL)
if @encounter_count > 0
@encounter_count -= 1
end
end
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
Ow... That's why I need help.
Why not just ignore the extra move_left or move_right when your switch is on?
#--------------------------------------------------------------------------
# Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_down(false, super_walk)
move2 = move_left(false, super_walk)
move_left(false, super_walk) #<============================================== This thing here
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 6 ? 4 : last_dir == 8 ? 2 : last_dir
@stop_count = 0
end
return move1 || move2
end
It's just I don't know how edit the script, too hard for me. (I don't know how to script)
I don't know if you understand my problem ? (Because my english...)
I thought Zexion said you were learning.
#---------------------------------------------------------------------------------
# SUPER WALK 1.2b + Déplacements isométriques
#---------------------------------------------------------------------------------
# Script créé par Zeus81
# Modifiée par Kreiss
#---------------------------------------------------------------------------------
DIAGONAL_SWICH = 1
class Game_Player
SUPER_WALK_SWITCH = 130 # id de l'interrupteur pour activer/désactiver le script
end
class Game_Character
alias super_walk_game_character_initialize initialize
def initialize
@x2 = @y2 = 0
super_walk_game_character_initialize
end
def super_walk_distance
@move_speed > 4 ? @move_speed > 5 ? 0.5 : 0.25 : 0.125
end
def moving?
@real_x != @x2*128 or @real_y != @y2*128
end
def passable?(x, y, d)
new_x = x + (d == 6 ? 1 : d == 4 ? -1 : 0)
new_y = y + (d == 2 ? 1 : d == 8 ? -1 : 0)
return false unless $game_map.valid?(new_x, new_y)
return true if @through
return false unless $game_map.passable?(x, y, d, self)
return false unless $game_map.passable?(new_x, new_y, 10-d)
$game_map.events.each_value do |event|
return false if event.x == new_x and event.y == new_y and !event.through and
(self != $game_player or !event.character_name.empty?)
end
return false if $game_player.x == new_x and $game_player.y == new_y and
!$game_player.through and !@character_name.empty?
return true
end
def moveto(x, y)
@x = @x2 = x % $game_map.width
@y = @y2 = y % $game_map.height
@real_x = @x * 128
@real_y = @y * 128
@prelock_direction = 0
end
def update_jump
@jump_count -= 1
@real_x = (@real_x * @jump_count + @x2 * 128) / (@jump_count + 1)
@real_y = (@real_y * @jump_count + @y2 * 128) / (@jump_count + 1)
end
def update_move
x128, y128, distance = @x2*128, @y2*128, 2**@move_speed
if x128 < @real_x; @real_x = [@real_x-distance*2, x128].max
elsif x128 > @real_x; @real_x = [@real_x+distance*2, x128].min
end
if y128 < @real_y; @real_y = [@real_y-distance, y128].max
elsif y128 > @real_y; @real_y = [@real_y+distance, y128].min
end
if @walk_anime; @anime_count += 1.5
elsif @step_anime; @anime_count += 1
end
end
def move_down(turn_enabled=true, super_walk=false)
turn_down if turn_enabled
if passable?(@x, @y, 2)
turn_down
if super_walk
@x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y, 2)
@x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y, 2)
@y2 += super_walk_distance
@y = @y2.round
else @y2 = @y += 1
end
increase_steps
elsif @y2 < @y
@y2 += 0.125
else
check_event_trigger_touch(@x, @y+1)
return false
end
return true
end
def move_left(turn_enabled=true, super_walk=false)
turn_left if turn_enabled
if passable?(@x, @y, 4)
turn_left
if super_walk
@y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 4)
@y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 4)
@x2 -= super_walk_distance
@x = @x2.round
else @x2 = @x -= 1
end
increase_steps
elsif @x2 > @x
@x2 -= 0.125
else
check_event_trigger_touch(@x-1, @y)
return false
end
return true
end
def move_right(turn_enabled=true, super_walk=false)
turn_right if turn_enabled
if passable?(@x, @y, 6)
turn_right
if super_walk
@y2 -= 0.125 if @y2 > @y and !passable?(@x, @y+1, 6)
@y2 += 0.125 if @y2 < @y and !passable?(@x, @y-1, 6)
@x2 += super_walk_distance
@x = @x2.round
else @x2 = @x += 1
end
increase_steps
elsif @x2 < @x
@x2 += 0.125
else
check_event_trigger_touch(@x+1, @y)
return false
end
return true
end
def move_up(turn_enabled=true, super_walk=false)
turn_up if turn_enabled
if passable?(@x, @y,
turn_up
if super_walk
@x2 -= 0.125 if @x2 > @x and !passable?(@x+1, @y,
@x2 += 0.125 if @x2 < @x and !passable?(@x-1, @y,
@y2 -= super_walk_distance
@y = @y2.round
else @y2 = @y -= 1
end
increase_steps
elsif @y2 > @y
@y2 -= 0.125
else
check_event_trigger_touch(@x, @y-1)
return false
end
return true
end
#--------------------------------------------------------------------------
# Move Lower Left
#--------------------------------------------------------------------------
def move_lower_left(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_down(false, super_walk)
move2 = move_left(false, super_walk)
move_left(false, super_walk) unless $game_switches[DIAGONAL_SWITCH]
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 6 ? 4 : last_dir == 8 ? 2 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
# Move Lower Right
#--------------------------------------------------------------------------
def move_lower_right(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_down( false, super_walk)
move2 = move_right(false, super_walk)
move_right(false, super_walk) unless $game_switches[DIAGONAL_SWITCH]
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 4 ? 6 : last_dir == 8 ? 2 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
# Move Upper Left
#--------------------------------------------------------------------------
def move_upper_left(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_up( false, super_walk)
move2 = move_left(false, super_walk)
move_left(false, super_walk) unless $game_switches[DIAGONAL_SWITCH]
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 6 ? 4 : last_dir == 2 ? 8 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
# Move Upper Right
#--------------------------------------------------------------------------
def move_upper_right(turn_enabled=true, super_walk=false)
last_dir = @direction
move1 = move_up( false, super_walk)
move2 = move_right(false, super_walk)
move_right(false, super_walk) unless $game_switches[DIAGONAL_SWITCH]
if !@direction_fix and turn_enabled ? move1 == move2 : move1 && move2
@direction = last_dir == 4 ? 6 : last_dir == 2 ? 8 : last_dir
@stop_count = 0
end
return move1 || move2
end
#--------------------------------------------------------------------------
def move_random
case rand(8)
when 0; move_lower_left
when 1; move_down
when 2; move_lower_right
when 3; move_left
when 4; move_upper_left
when 5; move_right
when 6; move_upper_right
when 7; move_up
end
end
def jump(x_plus, y_plus)
loop do
if (x_plus == 0 and y_plus == 0) or passable?(@x+x_plus, @y+y_plus, 0)
if x_plus.abs > y_plus.abs
x_plus < 0 ? turn_left : turn_right
else y_plus < 0 ? turn_up : turn_down
end unless x_plus == 0 and y_plus == 0
straighten
@x += x_plus
@x2 += x_plus
@y += y_plus
@y2 += y_plus
@jump_peak = 10 - @move_speed + Math.hypot(x_plus, y_plus).round
@jump_count = @jump_peak * 2
@stop_count = 0
return
end
x_plus -= 1 if x_plus > 0
x_plus += 1 if x_plus < 0
y_plus -= 1 if y_plus > 0
y_plus += 1 if y_plus < 0
end
end
end
class Game_Player
def update
last_x, last_y, last_rx, last_ry = @x, @y, @real_x, @real_y
super_walk = $game_switches[SUPER_WALK_SWITCH]
unless last_moving = moving? or @move_route_forcing or
$game_temp.message_window_showing or
$game_system.map_interpreter.running?
case Input.dir8
when 1; move_lower_left( true, super_walk)
when 2; move_down( true, super_walk)
when 3; move_lower_right(true, super_walk)
when 4; move_left( true, super_walk)
when 6; move_right( true, super_walk)
when 7; move_upper_left( true, super_walk)
when 8; move_up( true, super_walk)
when 9; move_upper_right(true, super_walk)
end
end
last_moving = last_x != @x || last_y != @y if super_walk
super
$game_map.scroll_left(last_rx-@real_x) if @real_x < last_rx and @real_x-$game_map.display_x < CENTER_X
$game_map.scroll_right(@real_x-last_rx) if @real_x > last_rx and @real_x-$game_map.display_x > CENTER_X
$game_map.scroll_up(last_ry-@real_y) if @real_y < last_ry and @real_y-$game_map.display_y < CENTER_Y
$game_map.scroll_down(@real_y-last_ry) if @real_y > last_ry and @real_y-$game_map.display_y > CENTER_Y
unless moving?
if last_moving and !check_event_trigger_here([1,2])
if @encounter_count > 0 and !($DEBUG and Input.press?(Input::CTRL))
@encounter_count -= 1
end
end
if Input.trigger?(Input::C)
check_event_trigger_here([0])
check_event_trigger_there([0,1,2])
end
end
end
end
Anyways, just change DIAGONAL_SWITCH to whatever switch ID you want to use.
It work now! It's very simple... I'm feel idiot. xD
Thanks a lot !