主にRPGツクールVXAceを扱うブログです。 ここに公開してあるスクリプトは全部自由に使用してもらってかまいません。 改造なり何なりして好きに使ってください。
[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
ただいまコメントを受けつけておりません。
#--------------------------------------------------------------------------
# ● キャラクターから遠ざかる
#--------------------------------------------------------------------------
def move_away_from_character(character)
sx = distance_x_from(character.x)
sy = distance_y_from(character.y)
if sx.abs > sy.abs
move_straight(sx > 0 ? 6 : 4)
move_straight(sy > 0 ? 2 : 8) if !@move_succeed && sy != 0
elsif sy != 0
move_straight(sy > 0 ? 2 : 8)
move_straight(sx > 0 ? 6 : 4) if !@move_succeed && sx != 0
end
end
の!@move_succeed && sy != 0 の sy !=0の部分のせいなのですが #--------------------------------------------------------------------------
# ● キャラクターから遠ざかる
#--------------------------------------------------------------------------
def move_away_from_character(character)
sx = distance_x_from(character.x)
sy = distance_y_from(character.y)
if sx.abs > sy.abs
move_straight(sx > 0 ? 6 : 4)
move_straight(sy > 0 ? 2 : 8) if !@move_succeed
elsif sy != 0
move_straight(sy > 0 ? 2 : 8)
move_straight(sx > 0 ? 6 : 4) if !@move_succeed
end
end
#--------------------------------------------------------------------------
# ● キャラクターから遠ざかる
#--------------------------------------------------------------------------
def move_away_from_character(character)
sx = distance_x_from(character.x)
sy = distance_y_from(character.y)
if sx.abs > sy.abs
move_straight(sx > 0 ? 6 : 4)
move_straight(sy > 0 ? 2 : 8) if !@move_succeed
move_straight(sy > 0 ? 8 : 2) if !@move_succeed
elsif sy != 0
move_straight(sy > 0 ? 2 : 8)
move_straight(sx > 0 ? 6 : 4) if !@move_succeed
move_straight(sx > 0 ? 4 : 6) if !@move_succeed
end
end