i just update a feature :
* block if event not through
- it have a problem is distance too long but i think i will edit some think but not here to fix it.
def passable in Game_Character Class
change in :
* block if event not through
- it have a problem is distance too long but i think i will edit some think but not here to fix it.
def passable in Game_Character Class
Code:
def passable?(mode = 0)
left_x = @real_x + 32 >> 7 # 4 << 3
right_x = @real_x + 110 >> 7 # 28 << 3
up_y = @real_y + 16>> 7 # 2 << 3
down_y = @real_y + 110 >> 7 # 28 << 3
# Get new coordinates
if mode == 0
if @xv > 0
return false unless $game_map.passable?(right_x, up_y,6)
return false unless $game_map.passable?(right_x, down_y,6)
else
return false unless $game_map.passable?(left_x, up_y,4)
return false unless $game_map.passable?(left_x, down_y,4)
end
else
if @yv > 0
return false unless $game_map.passable?(left_x, down_y,2)
return false unless $game_map.passable?(right_x, down_y,2)
else
return false unless $game_map.passable?(left_x, up_y,8)
return false unless $game_map.passable?(right_x, up_y,8)
end
end
if @through
return true
end
# Loop all events
for event in $game_map.events.values
new_x = (event.direction == 6 ? ((@real_x + 32 >> 7) + 1) : event.direction == 4 ? ((@real_x + 110 >> 7) + 1) : 0)
new_y = (event.direction == 2 ? ((@real_y + 16 >> 7) + 1) : event.direction == 8 ? ((@real_y + 110 >> 7) + 1) : 0)
# If event coordinates are consistent with move destination
if event.x == new_x and event.y == new_y
#If through is OFF
unless event.through
# If self is event
if self != $game_player
# impassable
return false
end
# With self as the player and partner graphic as character
if event.character_name != ""
# impassable
return false
end
end
end
end
new1_x = ($game_player.direction == 6 ? ((@real_x + 32 >> 7) + 1) : $game_player.direction == 4 ? ((@real_x + 110 >> 7) + 1) : 0)
new1_y = ($game_player.direction == 2 ? ((@real_y + 16 >> 7) + 1) : $game_player.direction == 8 ? ((@real_y + 110 >> 7) + 1) : 0)
#if is player
if(self == $game_player)
#Loop all events
for event in $game_map.events.values
if $game_player.x < event.x
if(event.x - $game_player.x) < 2
unless event.through
return false
end
end
end
if $game_player.x > event.x
if($game_player.x - event.x) < 2
unless event.through
return false
end
end
end
end
end
if $game_player.x == new1_x and $game_player.y == new1_y
# If through is OFF
unless $game_player.through
# If your own graphic is the character
if @character_name != ""
# impassable
return false
end
end
end
return true
end
change in :
Code:
#if is player
if(self == $game_player)
#Loop all events
for event in $game_map.events.values
#case 1 : position of player small than event
if $game_player.x < event.x
if(event.x - $game_player.x) < 2
unless event.through # if through
return false
end
end
end
#case 1 : position of player lager than event
if $game_player.x > event.x
if($game_player.x - event.x) < 2
unless event.through # if through
return false
end
end
end
end
end