#초간단스크립트
class Game_Character
def go_event(id)
ex = @x - $game_map.events[id].x
ey = @y - $game_map.events[id].y
if ex == 0 and ey == 0
return
end
abs_ex = ex.abs
abs_ey = ey.abs
if abs_ex == abs_ey
rand(2) == 0 ? abs_ex += 1 : abs_ey += 1
end
if abs_ex > abs_ey
ex > 0 ? move_left : move_right
if not moving? and ey != 0
ey > 0 ? move_up : move_down
end
else
ey > 0 ? move_up : move_down
if not moving? and ex != 0
ex > 0 ? move_left : move_right
end
end
end
def back_event(id)
ex = @x - $game_map.events[id].x
ey = @y - $game_map.events[id].y
if ex == 0 and ey == 0
return
end
abs_ex = ex.abs
abs_ey = ey.abs
if abs_ex == abs_ey
rand(2) == 0 ? abs_ex += 1 : abs_ey += 1
end
if abs_ex > abs_ey
ex > 0 ? move_right : move_left
if not moving? and ey != 0
ey > 0 ? move_down : move_up
end
else
ey > 0 ? move_down : move_up
if not moving? and ex != 0
ex > 0 ? move_right : move_left
end
end
end
end
안봐도 아실거라 믿습니다만
막상만들어봣더니
존x좋군?(이미지짤없어서 ㅈㅅ)
이 스크립트이름은 '이벤트이동' 이라 칭하시면 ㄳ ㅇㅋ?
go_event(id):이벤트id에 다가간다
back_event(id):이벤트id으로 도망간다
class Game_Character
def go_event(id)
ex = @x - $game_map.events[id].x
ey = @y - $game_map.events[id].y
if ex == 0 and ey == 0
return
end
abs_ex = ex.abs
abs_ey = ey.abs
if abs_ex == abs_ey
rand(2) == 0 ? abs_ex += 1 : abs_ey += 1
end
if abs_ex > abs_ey
ex > 0 ? move_left : move_right
if not moving? and ey != 0
ey > 0 ? move_up : move_down
end
else
ey > 0 ? move_up : move_down
if not moving? and ex != 0
ex > 0 ? move_left : move_right
end
end
end
def back_event(id)
ex = @x - $game_map.events[id].x
ey = @y - $game_map.events[id].y
if ex == 0 and ey == 0
return
end
abs_ex = ex.abs
abs_ey = ey.abs
if abs_ex == abs_ey
rand(2) == 0 ? abs_ex += 1 : abs_ey += 1
end
if abs_ex > abs_ey
ex > 0 ? move_right : move_left
if not moving? and ey != 0
ey > 0 ? move_down : move_up
end
else
ey > 0 ? move_down : move_up
if not moving? and ex != 0
ex > 0 ? move_right : move_left
end
end
end
end
안봐도 아실거라 믿습니다만
막상만들어봣더니
존x좋군?(이미지짤없어서 ㅈㅅ)
이 스크립트이름은 '이벤트이동' 이라 칭하시면 ㄳ ㅇㅋ?
go_event(id):이벤트id에 다가간다
back_event(id):이벤트id으로 도망간다