Project1
标题:
VX如何可以进行“斜走”(双键同时按下)
[打印本页]
作者:
tjjlb
时间:
2012-11-6 20:59
标题:
VX如何可以进行“斜走”(双键同时按下)
本帖最后由 tjjlb 于 2012-11-6 21:18 编辑
VX如何可以进行“斜走”?(双键同时按下)
例如 ↑ 和 → 一起按下,就可以像右上方行走
@protosssonny
P叔这次可以么?
感谢P叔!!!
作者:
怪蜀黍
时间:
2012-11-6 21:17
简单的饭菜应该留给大家。
但是你又是指定P叔回答,浪费饭菜了。
还有就是@失效了。
按照《6道》作者的方法吧,《八方向行走脚本》是可行的。
八方向行走脚本:
#==============================================================================
# ■ Game_Character
#==============================================================================
class Game_Character
#--------------------------------------------------------------------------
# ● 八方向
#--------------------------------------------------------------------------
def direction_8dir
return @direction
end
#--------------------------------------------------------------------------
# ● 变成指定方向
# direction : 方向
#--------------------------------------------------------------------------
alias set_direction_8fangxiang set_direction
def set_direction(direction)
last_dir = @direction
set_direction_8fangxiang(direction)
if !@direction_fix && direction != 0
@direction_8dir = direction
end
end
#--------------------------------------------------------------------------
# ● 向左下移动
#--------------------------------------------------------------------------
alias move_lower_left_8fangxiang move_lower_left
def move_lower_left
move_lower_left_8fangxiang
@direction_8dir = 1 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● 向右下移动
#--------------------------------------------------------------------------
alias move_lower_right_8fangxiang move_lower_right
def move_lower_right
move_lower_right_8fangxiang
@direction_8dir = 3 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● 向左上移动
#--------------------------------------------------------------------------
alias move_upper_left_8fangxiang move_upper_left
def move_upper_left
move_upper_left_8fangxiang
@direction_8dir = 7 unless @direction_fix
end
#--------------------------------------------------------------------------
# ● 向右上移动
#--------------------------------------------------------------------------
alias move_upper_right_8fangxiang move_upper_right
def move_upper_right
move_upper_right_8fangxiang
@direction_8dir = 9 unless @direction_fix
end
end
#==============================================================================
# ■ Game_Party
#==============================================================================
class Game_Party < Game_Unit
def decrease_steps
@steps -= 1
end
end
#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
#--------------------------------------------------------------------------
# ●八方向
#--------------------------------------------------------------------------
def direction_8dir
@direction_8dir = @direction if @direction_8dir == nil
return @direction_8dir
end
#--------------------------------------------------------------------------
# ● 八方向按键
#--------------------------------------------------------------------------
def move_by_input
return unless movable?
return if $game_map.interpreter.running?
last_steps = $game_party.steps
case Input.dir8
when 1; move_down; move_left; @direction = 2
when 2; move_down
when 3; move_down; move_right; @direction = 6
when 4; move_left
when 6; move_right
when 7; move_up; move_left; @direction = 4
when 8; move_up
when 9; move_up; move_right; @direction = 8
else; return
end
@direction_8dir = Input.dir8
# 斜方向移动正确步数计算
if $game_party.steps - last_steps == 2
$game_party.decrease_steps
end
end
#--------------------------------------------------------------------------
# ● 移动更新
#--------------------------------------------------------------------------
def update_move
distance = 2 ** @move_speed
if dash?
distance *= 2
end
distance = Integer(distance)
@real_x = [@real_x - distance, @x * 256].max if @x * 256 < @real_x
@real_x = [@real_x + distance, @x * 256].min if @x * 256 > @real_x
@real_y = [@real_y - distance, @y * 256].max if @y * 256 < @real_y
@real_y = [@real_y + distance, @y * 256].min if @y * 256 > @real_y
update_bush_depth unless moving?
if @walk_anime
@anime_count += 1.5
elsif @step_anime
@anime_count += 1
end
end
end
#==============================================================================
# ■ Sprite_Character
#==============================================================================
class Sprite_Character < Sprite_Base
ANIME_TABLE = { 1=>2, 3=>6, 7=>4, 9=>8 }
#--------------------------------------------------------------------------
# ● 更新位图
#--------------------------------------------------------------------------
alias update_bitmap_8fangxiang update_bitmap
def update_bitmap
name_changed = (@character_name != @character.character_name)
update_bitmap_8fangxiang
if @tile_id > 0
@enable_slant = false
return
end
return unless name_changed
@enable_slant = true
begin
@character_name_slant = @character_name + "#"
Cache.character(@character_name_slant)
rescue
@enable_slant = false
end
end
#--------------------------------------------------------------------------
# ● 更新传送矩形
#--------------------------------------------------------------------------
alias update_src_rect_8fangxiang update_src_rect
def update_src_rect
return if @tile_id > 0
if @enable_slant
update_src_rect_for_slant
else
update_src_rect_8fangxiang
end
end
#--------------------------------------------------------------------------
# ● 更新斜方向传送矩形
#--------------------------------------------------------------------------
def update_src_rect_for_slant
index = @character.character_index
pattern = @character.pattern < 3 ? @character.pattern : 1
sx = (index % 4 * 3 + pattern) * @cw
dir = @character.direction_8dir
case dir % 2
when 0 # 上下左右
if @last_slant
self.bitmap = Cache.character(@character_name)
@last_slant = false
end
else
unless @last_slant
self.bitmap = Cache.character(@character_name_slant)
@last_slant = true
end
dir = ANIME_TABLE[dir]
end
sy = (index / 4 * 4 + (dir - 2) / 2) * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
end
复制代码
作者:
tjjlb
时间:
2012-11-6 21:18
protosssonny 发表于 2012-11-6 21:17
简单的饭菜应该留给大家。
但是你又是指定P叔回答,浪费饭菜了。
还有就是@失效了。{:4_ ...
感谢!!!
作者:
826472493
时间:
2012-11-11 10:37
刚好我也在找
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X3.1